Heroku's official Cloud Native Buildpack for sbt usage in Scala applications.
The buildpack will detect if your application requires sbt
if any one of the following file patterns match:
project/build.properties
project/*.scala
*.sbt
.sbt/*.scala
An sbt wrapper script is written into its own layer that will contain the sbt
build tooling. This wrapper script then executes to download the sbt version specified in your project/build.properties
file.
By default, the sbt command used to build the application is sbt compile stage
.
Applications that require customizations to this process to build successfully should refer to the Customizing
section of this document.
This buildpack exposes the following configurable settings. The order they appear in the table indicates their precedence.
For example, if your application contains:
- a
system.properties
file with thesbt.project
property set- and the environment variable
SBT_PROJECT
is setThen the value from
system.properties
will be used.
When this setting is configured, the default build tasks will be prepended with the supplied project name. E.g.; the default
compile
and stage
tasks would become {subproject}/compile
and {subproject}/stage
.
From | Path | Name |
---|---|---|
Java property file | system.properties |
sbt.project |
Environment | SBT_PROJECT |
This setting will prepend the supplied tasks to the list of tasks to run during the build. These must be supplied as
a string of space-separated task names. E.g.; a value of task1 task2
would cause the build step to be invoked with
sbt task1 task2 compile stage
.
From | Path | Name |
---|---|---|
Java property file | system.properties |
sbt.pre-tasks |
Environment | SBT_PRE_TASKS |
This setting will override the default build tasks of compile
and stage
. These must be supplied as
a string of space-separated task names. E.g.; a value of mybuild
would cause the build step to be invoked with
sbt mybuild
.
From | Path | Name |
---|---|---|
Java property file | system.properties |
sbt.tasks |
Environment | SBT_TASKS |
This setting will prepend a clean
task to before all other tasks to run during the build. This must be supplied as a
value of either true
or false
. E.g.; setting this value to true
would cause the build step to be invoked with
sbt clean compile stage
.
From | Path | Name |
---|---|---|
Java property file | system.properties |
sbt.clean |
Environment | SBT_CLEAN |
By default, the sbt
executable as well as its caches are only available during the build process. If you need
sbt
to launch your application you can configure this setting with a value of true
.
From | Path | Name |
---|---|---|
Java property file | system.properties |
sbt.available-at-launch |
Environment | SBT_AVAILABLE_AT_LAUNCH |
If the SBT_OPTS
environment variable is defined when sbt starts, its content are passed as command line arguments to
the JVM running sbt.
If a file named .sbtopts
exists, its content is appended to SBT_OPTS
.
When passing options to the underlying sbt JVM, you must prefix them with -J
. Thus, setting stack size for the compile
process would look like this:
heroku config:set SBT_OPTS="-J-Xss4m"
From | Path | Name |
---|---|---|
Environment | SBT_OPTS |
|
Options file | .sbtopts |
jdk
: To compile Java sources a JDK is required. It can be provided by theheroku/jvm
(Source, Readme) buildpack.jvm-application
: This is not a strict requirement of the buildpack. Requiringjvm-application
ensures that this buildpack can be used even when no other buildpack requiresjvm-application
.
jvm-application
: Allows other buildpacks to depend on a compiled JVM application.
See LICENSE file.