The Scala version used by sbt itself and its plugins is completely independent from the Scala version used to compile the code in your project. The sbt version determines the Scala version it uses:
- sbt 0.13 uses Scala 2.10
- sbt 1.x uses Scala 2.12
- sbt 2.x will use Scala 3
You can set this version in project/build.properties
, for example:
sbt.version = 1.1.1
The sbt plugins you want to use have to be compatible with the given version of sbt (and many are cross-compiled with both 0.13 and 1.x).
To set the version of Scala you want to use for the code in you project, use scalaVersion
setting in your build.sbt
:
scalaVersion := "2.12.4"
Again, it's independent from the version for sbt. You can also cross-compile your code for several Scala versions:
scalaVersion := "2.12.4"
crossScalaVersions := Seq("2.11.12", "2.12.4")
Then if you run compile
in sbt, it will use Scala 2.12.4, and if you run +compile
, it will first compile it with Scala 2.11.12 and then with 2.12.4. See sbt docs for more about Cross-building.