Scala 版本未更新

Scala version not updating

我的项目使用scala版本2.10.2。我正在尝试更新到 2.11.4。我更新了我的 build.sbt。但是现在当我 运行 sbt compile 它仍然显示我 Resolving org.scala-lang#scala-library;2.10.2 ...。我相信这意味着我的 Scala 版本尚未更新。我做错了什么?

我希望我已经把我的问题说清楚了。如果有任何混淆,请询问。提前致谢。

您可以随时使用 show 查看任何设置的值:

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

scalaVersion 告诉你你的项目是用哪个 Scala 版本构建的。您还可以使用 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

这可能与用于编译构建定义的 Scala 版本不同。 sbt 0.13 始终为此使用 Scala 2.10:

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

你无法改变这一点;由sbt版本决定。