Quick Start
Prerequisites
You need a usual Scala development environment: JDK, sbt, scala-cli an IDE of your choice.
Install Scala 3 using Coursier
Install Scala 3 on your machine using Coursier.
Along with managing JVMs, cs setup
also installs useful command-line tools:
Commands | Description |
---|---|
scalac | the Scala compiler |
scala , scala-cli | Scala CLI, interactive toolkit for Scala |
sbt , sbtn | The sbt build tool |
amm | Ammonite is an enhanced REPL |
scalafmt | Scalafmt is the Scala code formatter |
For more information about cs
, read
coursier-cli documentation.
You also can use Scala CLI instead of SBT. See AdaStream for an example of a project that uses Scala CLI.
Alternative: use Nix package manager
The easiest way to get started is to use Nix package manager and the Scalus Starter Project.
Clone Scalus Starter Project
Clone the Scalus Starter Project to get started with Scalus.
If you use Nix, we provided flakes.nix
file to get a development environment with all the
required tools installed.
git clone https://github.com/nau/scalus-starter.git
cd scalus-starter
nix develop
code . # opens VSCode
or open the project in your favorite IDE
Run
sbtn
to enter the interactive sbt shell.
Learn about using sbt in the sbt documentation.
Building with sbt
Run sbtn
to enter the sbt shell. sbtn
is a thin wrapper around sbt
for faster startup.
Run compile
to compile the project.
Run test
to run the tests.
Run integration/test
to run the integration tests.
Run scalafmtAll
to format the code.
Run ~compile
to automatically recompile the project when the source code changes.
Run ~test
to automatically run the tests when the source code changes.
Adding Scalus to existing sbt project
If you already have an sbt project, you can add Scalus to it.
Add the following to your build.sbt
file:
scalaVersion := "3.3.5"
libraryDependencies += "org.scalus" %% "scalus" % "0.8.5"
addCompilerPlugin("org.scalus" %% "scalus-plugin" % "0.8.5")
That's it! You can now start using Scalus in your project.