This is a proposal for how JAVA_OPTS, SBT_OPTS, and various command line options should for for both Bash (Linux / macOS) and Windows Batch. For backward compatibility and convenience, it’s meant not to be huge departure from the way it’s already implemented.
There are mainly three ways of passing arguments to
sbt launcher script:
- command line arguments
/etc/sbt/sbtopts are variants of the above.
The content of
JAVA_OPTS is passed in
java command line without modification. This could be something like
JAVA_OPTS is empty, it should default to
-Dfile.encoding=UTF-8. Generally we should discourage the use of
JAVA_OPTS and use
The content of
SBT_OPTS is passed into the same mapping and processing as the command line argument:
-Xms2048M -Xmx2048M -Xss4M --supershell=false
In terms of the feature,
SBT_OPT should act as a superset of
-Dkey=val as well as
sbt script specific features such as
command line argument
By default, command line argument to
sbt script is assumed to be a command passed through to the sbt’s launcher JAR, and thereby sbt Main (“mothership”) unless they are explicitly specified as command line options at the
sbt script level.
They are basically the ones specified in https://github.com/sbt/sbt-launcher-package, such as
For the discussion of passing arguments to JVM here are the relevant ones:
-Dkey=valare passed directly as JVM argument.
-X*. Options starting with
-Xshould be passed directly as JVM argument.
-J-X*. This is same as above, except
-J-X*is for keeping compatibility with sbt-extras script.
- I don’t know if we need to support
-S-X*. If we’re not doing that already, I think it’s ok to skip it.
-XX*should be covered by