是否有必要更改 SBT 及其插件使用的 Scala 版本?
我正在使用 Play Framework 2.1.1-RC2。我想创建将使用 Scala 2.10.1 的新项目。为了实现这一点,我做了以下
"org.scala-lang" % "scala-compiler" % "2.10.1"
增加了依赖Build.scala
- 将变量初始化
scalaVersion
为 2.10.1 inBuild.scala
然后我运行play about
命令并得到以下输出
[test2] $ about
Getting Scala 2.10.1 ...
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.10.1/scala-compiler-2.10.1.jar ...
[SUCCESSFUL ] org.scala-lang#scala-compiler;2.10.1!scala-compiler.jar (7401ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.1/scala-library-2.10.1.jar ...
[SUCCESSFUL ] org.scala-lang#scala-library;2.10.1!scala-library.jar (4309ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.10.1/scala-reflect-2.10.1.jar ...
[SUCCESSFUL ] org.scala-lang#scala-reflect;2.10.1!scala-reflect.jar (2144ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/jline/2.10.1/jline-2.10.1.jar ...
[SUCCESSFUL ] org.scala-lang#jline;2.10.1!jline.jar (201ms)
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
5 artifacts copied, 0 already retrieved (24386kB/58ms)
[info] This is sbt 0.12.2
[info] The current project is {file:/C:/work/test_projects/test2/}test2
[info] The current project is built against Scala 2.10.1
[info] Available Plugins: play.Project, sbt.PlayProject, com.typesafe.sbteclipse.plugin.EclipsePlugin, com.typesafe.sbtidea.SbtIdeaPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
最后一行是我所关心的。它说使用了 Scala 2.9.2。我该如何改变呢?它会影响将用于编译我的代码的版本吗?
更新:看起来这种更改编译器版本的方式无法正常工作。运行我的应用程序后,我在游戏控制台中收到以下警告:
[warn] Potentially incompatible versions of dependencies of {file:/C:/work/test_projects/test2/}test2:
[warn] org.scala-lang: 2.10.1, 2.10.0
[info] Compiling 5 Scala sources and 1 Java source to C:\work\test_projects\test2\target\scala-2.10\classes...
[info] 'compiler-interface' not yet compiled for Scala 2.10.1. Compiling...
[info] Compilation completed in 8.608 s
[warn] Potentially incompatible versions of dependencies of {file:/C:/work/test_projects/test2/}test2:
[warn] org.scala-lang: 2.10.1, 2.10.0
[info] play - Application started (Dev)
[warn] Potentially incompatible versions of dependencies of {file:/C:/work/test_projects/test2/}test2:
[warn] org.scala-lang: 2.10.1, 2.10.0