Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are sbtconfig.txt and sbtopts used for?

Tags:

sbt

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.

like image 205
Sawyer Avatar asked Dec 16 '13 14:12

Sawyer


1 Answers

sbtconfig.txt (Windows only) is a configuration file that lists JVM options, and is used by sbt.bat. sbtopts is used by sbt shell script.

It's probably better to read the actual script to understand exactly how's it's used, but eventually the contents would end up in a variable named _JAVA_OPTS and passed into:

"%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -cp "%SBT_HOME%sbt-launch.jar" xsbt.boot.Boot %*

So you should be able to add -Dinput.encoding=Cp1252 or whatever in there. If that's not working for you, either %JAVA_OPTS% could be non-empty (then sbtconfig.txt is ignored), or %SBT_OPTS% could be overriding the setting to something else? Not sure.

You can check to see if the properties are set or not using sbt console:

scala> sys.props("input.encoding")
res0: String = null

scala> sys.props("file.encoding")
res1: String = UTF-8

Another question is, can I put these two files somewhere in ~/.sbt/ ?

You should be able to modify the sbt.bat to get that done. In fact looking at sbt shell script, it says it looks at .sbtopts. You can use Cygwin and see if that works.

like image 188
Eugene Yokota Avatar answered Jan 01 '23 20:01

Eugene Yokota