The Simple Build Tool (SBT for short) can be used to build Scala (or Java) project code. This includes managing code, dependencies, and resources that must be built, tested, and/or compiled to a .jar or other artifact. Custom tasks can be created to manage all of these processes.
A note on the name; SBT is sometimes referred to as the 'Scala Build Tool'. While this was not the original intent, it has come to be commonly used as well. SBT may be used to build any project on the JVM.
.sbt files, or 'SBT build definitions' are specially interpreted files, written in Scala, that are used by SBT to define a build. .scala build definitions may also be written and imported into an .sbt file.
Versions prior to 13.6 required that any .sbt file has each statement separated by a blank line. Without the blank line, the .sbt file will break.
| Version | State | Release Date |
|---|---|---|
| 0.13.12 | Stable | 2016-07-17 |
This assumes you have installed both Eclipse and SBT.
Install the SBT plugin for Eclipse from the Eclipse marketplace.
In the command line switch directory to the root directory of the project.
$ cd ~/home/sample/project
Execute sbt, which will load the project.
$ sbt
Compile the project to ensure dependencies are obtainable.
> compile
Run the eclipse task:
> eclipse
Go into Eclipse and select the menu option:
File > New > Project From Existing Sources
In the wizard, navigate to your project directory and select it. Eclipse will handle the rest.
Full official instructions can be found here.
Install MacPorts. Then, in the terminal execute:
port install sbt Install Homebrew. Then, in the terminal execute:
brew install sbt Download sbt All platforms (tgz) installation from SBT.
sudo su cd /opt mkdir sbt cd sbt curl https://dl.bintray.com/sbt/native-packages/sbt/0.13.13/sbt-0.13.13.tgz -o sbt-0.13.13.tgz Then, execute following
tar zxf sbt-0.13.13.tgz ln -s sbt-0.13.13 latest Inside your $HOME make sure to update ~/.profile - by adding following lines
export SBT_HOME=/opt/sbt/latest export PATH=$PATH:$SBT_HOME/bin In the terminal execute:
which sbt You should expect output similar to:
/opt/local/bin/sbt If you get no output sbt is not installed.
Full instructions can be found here.
Set the Java Environment variable.
export JAVA_HOME=/usr/local/java/jdk1.8.0_102 echo $JAVA_HOME /usr/local/java/jdk1.8.0_102 export PATH=$PATH:$JAVA_HOME/bin/ echo $PATH ...:/usr/local/java/jdk1.8.0_102/bin/ Install Scala.
sudo wget http://www.scala-lang.org/files/archive/scala-2.11.8.deb sudo dpkg -i scala-2.11.8.deb sudo apt-get update sudo apt-get install scala Install SBT.
wget https://bintray.com/artifact/download/sbt/debian/sbt-0.13.9.deb sudo dpkg -i sbt-0.13.9.deb sudo apt-get update sudo apt-get install sbt Download SBT repository definitions and add it to YUM:
curl https://bintray.com/sbt/rpm/rpm | sudo tee /etc/yum.repos.d/bintray-sbt-rpm.repo Install SBT according to the definitions previously added to YUM:
sudo yum install sbt MSI installers can be found here. This is the latest stable version. Download and execute to install.
Use the WindowsKey + R , type cmd .
Alternatively, navigate to the .sbt (for example, in C:\Users\Hopper ) and type cmd in the address bar.
Type sbt about to get version information, verifying it is installed. You should see something like this:
Java HotSpot(TM) 64-But Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 [info] Set current project to root--sbt (in build file:/C:/Users/Hopper/.sbt/) [info] This is sbt 0.13.8 ...