scalasbtscala-2.10scala-2.11

Scala version not updating


My project used Scala version 2.10.2. I am trying to update to 2.11.4. I have updated my build.sbt.

But now when I run sbt compile it still shows me Resolving org.scala-lang#scala-library;2.10.2 .... I believe it means that my Scala version hasn't been updated. What am I doing wrong?


Solution

  • You can always use show to see the value of any setting:

    % sbt
    [info] Loading project definition from ...
    [info] Set current project to ...
    > show scalaVersion
    [info] 2.12.0-M1
    

    scalaVersion tells you which Scala version your project is built with. You can also verify it using console:

    > console
    [info] Starting scala interpreter...
    [info] 
    Welcome to Scala version 2.12.0-M1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
    Type in expressions to have them evaluated.
    Type :help for more information.
    
    scala> scala.util.Properties.versionString
    res0: String = version 2.12.0-M1
    

    This may be different from the Scala version used to compile your build definition. sbt 0.13 always uses Scala 2.10 for that:

    > eval scala.util.Properties.versionString
    [info] ans: String = version 2.10.4
    

    You can't change that; it's determined by the sbt version.