What are sbtconfig.txt and sbtopts used for?

Viewed 9480

In the 0.13 release of sbt, I saw these two files in sbt/conf directory, it would be really nice if I can change option inside these files instead of the launcher script.

I changed some options in sbtopts, it doesn't take effect at all, and the sbtconfig.txt does work for some options but for this option, -Dinput.encoding=iso-8859-1 (I need this option to use up arrow key to view history, otherwise it shows me messy codes) it only take effect when I add it in the sbt.bat.

Another question is, can I put these two files somewhere in ~/.sbt/ ? I want to store all my sbt configurations in one place.

My OS is Windows 8.1 and working with the SBT 0.13.

2 Answers
$ man sbt
...

Java Options
       --java-home <path>
              alternate JAVA_HOME

       -Dkey=val
              pass -Dkey=val directly to the java runtime

       -J-X   pass option -X directly to the java runtime (-J is stripped)

       -S-X   add -X to sbt's scalacOptions (-S is stripped)
FILES
       ~/.sbt
              The user configuration directory.
       .jvmopts
              if this file exists in the current directory, its contents are appended to the JAVA_OPTS.
       .sbtopts
              if this file exists in the current directory, its contents are prepended to the runner args.
       /etc/sbt/sbtopts
              if this file exists, it is prepended to the runner args

ENVIRONMENT
       JAVA_OPTS
              If non-null a set of arguments passed to java.

       SBT_OPTS
              environment variable, if unset uses "-Dfile.encoding=UTF-8".

NOTES
       In the case of duplicated or conflicting options, the order above shows precedence: JAVA_OPTS lowest, command line options  high-
       est.

...

Examples:

$ pwd
/tmp/helo
$ cat .sbtopts
-Dinput.encoding=iso-8859-1
$ cat .jvmopts
-Xms512m
$ sbt -v console
[sbt_options] declare -a sbt_options=()
[process_args] java_version = '8'
# Executing command line:
java
-Xms512m
-Dinput.encoding=iso-8859-1
-Dsbt.script=/usr/bin/sbt
-jar
/home/hadoop/.cache/sbt/boot/sbt-launch/1.6.2/sbt-launch-1.6.2.jar
console

[info] welcome to sbt 1.6.2 (Debian Java 1.8.0_312)
[info] loading settings for project helo-build from site.sbt ...
[info] loading project definition from /tmp/helo/project
[info] loading settings for project helo from build.sbt ...
[info] set current project to helo (in build file:/tmp/helo/)
[info] Starting scala interpreter...
Welcome to Scala 2.12.15 (OpenJDK 64-Bit Server VM, Java 1.8.0_312).
Type in expressions for evaluation. Or try :help.

scala> sys.props("input.encoding")
res1: String = iso-8859-1

scala> :q

[success] Total time: 51 s, completed Apr 29, 2022 2:26:53 PM
Related