Last year I wrote an experimental sbt plugin called sbt-projectmatrix to improve the cross building in sbt. I've just released 0.2.0.
building against multiple Scala versions
After adding sbt-projectmatrix to your build, here's how you can set up a matrix with two Scala versions.
ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / version := "0.1.0-SNAPSHOT"
lazy val core = (projectMatrix in file("core"))
.settings(
name := "core"
)
.jvmPlatform(scalaVersions = Seq("2.12.8", "2.11.12"))
This will create subprojects coreJVM2_11
and coreJVM2_12
.
Unlike ++
style stateful cross building, these will build in parallel.