sbt Scala build tool
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
sbtcompiletestrun~testprojectsreloadconsoleConcepts
- build.sbt settings and tasks
- sbt shell keeps state warm
- target/ classes and reports
Run and build
sbtsbt <command>
compilerun <args>
runMain <class> <args>
cleanTest/compilepackagedocupdateexithelp <command>
Testing
testtestOnly <Suite>
testOnly <Suite> -- -z "<text>"
testQuickTest/consoleIntegrationTest/test
Watch mode
~compile~test~testQuick~runEnterProjects
projectsproject <id>
<id>/test<id>/compile
project /clean test; <a> ; <b>
Build definition
reloadreload pluginsreload returnset <key> := <value>
session saveshow <key>
inspect <key>
inspect tree <key>
taskssettingseval <expr>
consoleProjectCross building and REPL
consoleconsoleQuick+test++<version> test
+compilecrossScalaVersions
Publish and options
publishLocalpublishpublishM2dependencyTreesbt -J-Xmx2Gsbt -Dsbt.offline=true
sbt -Dsbt.version=<v>
sbt -Dsbt.ci=true
sbt --client <command>
sbt -Dsbt.task.timings=true
build.sbt basics
ThisBuild / scalaVersion := "3.3.4"lazy val root = (project in file(".")) .settings(name := "app")
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % Test
| Operator | Meaning |
|---|---|
:= |
Set a value |
+= |
Append one element |
++= |
Append a collection |
% |
Group % artifact % version |
%% |
Add the Scala suffix to the artifact |
sbt.version=1.10.10
Recipes
sbt~testOnly com.example.UserSpec
sbt "api/clean" "api/test"
sbt +test +publishLocal
sbt -Dsbt.ci=true -J-Xmx2G clean test



