0__ 0__ - 1 year ago 97
Scala Question

sbt console - set scala-version for all sub-projects

I have a multi-project build with

scalaVersion := "2.11.8"
for each module.

I want to run
for Scala 2.12.0-RC1 without touching the build file. I thought the following would work:

$ sbt
> set scalaVersion in ThisBuild := "2.12.0-RC1"
> test

But that does not alter the Scala version used, sbt still compiles with Scala 2.11.8. This only works for single module builds (without

How do I effectively override
for all sub-modules from the sbt console?

Answer Source

Your attempt doesn't work because the setting for the module takes priority over the setting for ThisBuild; it would work if you used scalaVersion in ThisBuild in the build file instead of setting it separately for each module. I don't know if there is a way to do this with anything except scalaVersion, but:

As a final note, you can use ++ to temporarily switch the Scala version currently being used to build. should be either a version for Scala published to a repository, as in ++ 2.10.0 or the path to a Scala home directory, as in ++ /path/to/scala/home. See Command Line Reference for details.

> ++2.12.0-RC1
> test
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download