Prerequisites: JDK - please download and install from AdoptOpenJDK
-
Install sbt:
Mac:
$ brew install sbt@1
Windows: Install msi from here
Linux: Installation instructions
-
Create new project from seed:
$ sbt new sbt/scala-seed.g8
After installing everything, you will be prompted for the project name:
A minimal Scala project. name [Scala Seed Project]:
Enter
kata
and thencd kata
-
You will find an example source file at
src/main/scala/example/Hello.scala
and an example test file atsrc/test/scala/example/HelloSpec.scala
. -
You may run the tests with:
sbt test
To have sbt watch the file system for changes(run tests on save), use
sbt ~test:compile
The seed is a template that can be found here. It sets up a new sbt project with some sensible defaults.
Structure of the project:
├── build.sbt // contains settings for the build, for e.g. Scala version, project version and project name
├── project // build support files
│ └── Dependencies.scala // lists dependencies
│ └── build.properties // defines sbt version
├── target // temporary folder for build output
└── src
├── main
│ └── scala // Scala code goes here
└── test
└── scala // Scala tests go here