- Get Scala from www.scala-lang.org
- Get SBT from www.scala-sbt.org
- Get Java from download.oracle.com
For example:
$ wget --no-cookies --no-check-certificate --header 'Cookie: oraclelicense=accept-securebackup-cookie' http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.rpm
To compile all code, do
$ sbt package
Alternatively, you can go to individual directories and type sbt run
, which in most cases should run the application (chapter 10 needs to start a jetty service, in which case you need sbt jetty:start
).
SBT has an interactive command line capabilites. For example, to continuously compile code on each source file change, do
$ sbt
...
> ~run
...
SBT will generate Scaladoc with sbt doc
command.
To add SBT Scalastyle plugin create the project/plugins.sbt
file:
$ cat <<EOF > project.plugin.sbt
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")
EOF
$ sbt scalastyleGenerateConfig
$ sbt scalastyle
...
Currently, you need to install the sbteclipse plugin with your SBT environment (add the following line to your build.sbt)
$ echo 'addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")' >> project/plugins.sbt
$ sbt eclipse
...
The eclipse
target will be added to create the Eclipse .project
and .classpath
files. Import the project from Eclipse for Scala.
Sbt does not clean target directories. For complete cleanup, do:
$ sbt clean
$ find . -name target -exec rm -rf {} \;