LinuxCommandLibrary

sbt

Build tool for Scala and Java projects.

TLDR

Start a REPL (interactive shell)

$ sbt
copy


Create a new Scala project from an existing Giter8 template hosted on GitHub
$ sbt new [scala/hello-world.g8]
copy


Compile and run all tests
$ sbt test
copy


Delete all generated files in the target directory
$ sbt clean
copy


Compile the main sources in src/main/scala and src/main/java directories
$ sbt compile
copy


Use the specified version of sbt
$ sbt -sbt-version [version]
copy


Use a specific jar file as the sbt launcher
$ sbt -sbt-jar [path]
copy


List all sbt options
$ sbt -h
copy

SYNOPSIS

sbt [-h] [-sbt-version sbt-version ] <commands> ...

DESCRIPTION

sbt Runs the Simple Build Tool using the currently installed java(1) The current directory is assumed to be the project.

OPTIONS

-h, -help

Show help options.

-v, -verbose

turn up the noise

-d, -debug

set sbt log level to debug

-no-colors

disable ANSI color codes

-sbt-create

start sbt even if current directory contains no sbt project

-sbt-dir <path>

path to global settings/plugins directory (default: ~/.sbt)

-sbt-boot <path>

path to shared boot directory (default: ~/.sbt/boot in 0.11 series)

-ivy <path>

path to local Ivy repository (default: ~/.ivy2)

-mem <integer>

set memory options (default: $sbt_mem, which is $(get_mem_opts $sbt_mem))

-no-share

use all local caches; no sharing

-no-global

uses global caches, but does not use global ~/.sbt directory.

-jvm-debug <port>

Turn on JVM debugging, open at the given port.

-batch

Disable interactive mode

-offline

put sbt in offline mode

SBT Version Options

-sbt-version <sbt-version>

Use the alternate system wide sbt-version The Simple Build Tool version to use. This script will download necessary versions using the curl(1) tool.

-sbt-jar <path>

use the specified jar as the sbt launcher

-sbt-rc

use an RC version of sbt

-sbt-snapshot

use a snapshot version of sbt

Java Options

-java-home <path>

alternate JAVA_HOME

-Dkey=val

pass -Dkey=val directly to the java runtime

-J-X

pass option -X directly to the java runtime (-J is stripped)

-S-X

add -X to sbt's scalacOptions (-S is stripped)

FILES

~/.sbt

The user configuration file.

.jvmopts

if this file exists in the current directory, its contents are appended to the JAVA_OPTS.

.sbtopts

if this file exists in the current directory, its contents are prepended to the runner args.

/etc/sbt/sbtopts

if this file exists, it is prepended to the runner args

ENVIRONMENT

JAVA_OPTS

If non-null a set of arguments passed to java.

SBT_OPTS

environment variable, if unset uses "$default_sbt_opts".

EXAMPLES

Most users of this script will only have to call "sbt" on the command line.

AUTHOR

Paul Phillips <paulp@typesafe.com>

Copied to clipboard