sbt
Scala build tool for JVM projects
TLDR
Start an interactive sbt shell in the current project
SYNOPSIS
sbt [options] [command...]
DESCRIPTION
sbt (Scala Build Tool) is the standard build tool for Scala projects. It handles compilation, testing, dependency management, packaging, and publishing. sbt uses a build definition written in Scala itself, typically in build.sbt.
sbt operates in two modes: batch mode where commands are passed as arguments and sbt exits after execution, and interactive mode where sbt starts a shell for continuous interaction. The interactive shell provides faster feedback since the JVM stays running between commands.
Key features include incremental compilation (only recompiling changed files), continuous execution using the ~ prefix (e.g., ~test runs tests on every file save), and cross-building for multiple Scala versions using + prefix.
PARAMETERS
-h, --help
Display help information-v, --verbose
Enable verbose logging--debug
Enable debug logging-no-colors
Disable ANSI color codes in output--batch
Disable interactive mode--sbt-version version
Use specified sbt version--java-home path
Specify alternate Java installation directory-Dkey=val
Pass system property to the JVM-J-Xfoo
Pass JVM option directly (e.g., -J-Xmx2048M)-mem MB
Set memory allocation (e.g., -mem 2048)
COMMON COMMANDS
compile
Compile main sourcestest
Run all testsrun
Run the main classconsole
Start Scala REPL with project classpathclean
Delete generated files (target directory)reload
Reload build definitionupdate
Resolve and download dependenciespackage
Create JAR file from compiled classespublish
Publish artifacts to configured repositorypublishLocal
Publish artifacts to local Ivy repository
CAVEATS
sbt can be memory-intensive; large projects may require increasing heap size via SBT_OPTS or .jvmopts. The first run downloads dependencies and may be slow. Build definitions have their own learning curve with settings, tasks, and scopes.
HISTORY
sbt was created by Mark Harrah in 2008 and has become the de facto build tool for Scala projects. It was originally called "Simple Build Tool" but the name was later de-emphasized. The project is now maintained by Lightbend (formerly Typesafe) and the Scala community. Version 1.0 was released in 2017, bringing significant improvements to build semantics and performance.
