[英]Why does sbt download a different Scala version than the one in build.sbt?
The build.sbt already set build.sbt已经设置好了
scalaVersion := "2.11.7"
However, whenever i run sbt where the build.sbt resides, I always get this error 但是,每当我运行build.sbt所在的sbt时,我总是会收到此错误
org.scala-lang#scala-library;2.10.5: configuration not found in
org.scala-lang#scala-library;2.10.5: 'master(compile)'. Missing
configuration: 'compile'. It was required from org.scalaz#scalaz-
effect_2.10;7.1.0 compile
At the start, it's actually getting the version 2.10.5 一开始,实际上它的版本是2.10.5
Getting Scala 2.10.5 (for sbt)...
Now I cannot proceed. 现在我无法继续。 I am running in my macbook. 我在我的macbook中运行。
sbt and your application (managed by sbt) have different requirements for Scala. sbt和你的应用程序(由sbt管理)对Scala有不同的要求。 They both Scala applications so they surely need a Scala runtime. 它们都是Scala应用程序,因此它们肯定需要Scala运行时。
sbt uses a fixed version of Scala and all the plugins you could ever install in your project should be compatible to that particular Scala version. sbt使用固定版本的Scala,您可以在项目中安装的所有插件应该与特定的Scala版本兼容。 You cannot change the Scala version for sbt. 您无法更改sbt的Scala版本。 It's "burried" in the code and not something users should change. 它在代码中被“埋葬”,而不是用户应该改变的东西。
Your Scala/sbt projects can however use whatever they want for Scala. 但是,您的Scala / sbt项目可以使用他们想要的任何Scala。 It's a separate concern. 这是一个单独的问题。 You can use build.sbt
and scalaVersion
to set your Scala version. 您可以使用build.sbt
和scalaVersion
来设置Scala版本。
Having said that, at the very beginning, sbt will always download its own internal dependencies, Scala including. 话虽如此,在一开始,sbt将始终下载自己的内部依赖项,Scala包括。 It is then saved in ~/.sbt/boot
. 然后将其保存在~/.sbt/boot
。
➜ $ ls -l ~/.sbt/boot
total 424
-rw-r--r-- 1 jacek staff 0 13 sie 20:22 sbt.boot.lock
drwxr-xr-x 4 jacek staff 136 6 wrz 2015 scala-2.10.4
drwxr-xr-x 4 jacek staff 136 2 wrz 2015 scala-2.10.5
drwxr-xr-x 4 jacek staff 136 31 sty 2016 scala-2.10.6
drwxr-xr-x 4 jacek staff 136 3 lis 2015 scala-2.11.5
-rw-r--r-- 1 jacek staff 217029 20 lip 10:37 update.log
Depending on the sbt version you use, you may see different Scala versions being downloaded but they are internal to sbt. 根据您使用的sbt版本,您可能会看到正在下载的不同Scala版本,但它们是sbt的内部版本。 You should not be concerned with that. 你不应该担心这一点。 Just accept it :) 接受它:)
ps The versions of Scala used by sbt internally are not at all different from the ones you may have downloaded already for your Scala/sbt projects. ps sbt内部使用的Scala版本与您可能已为Scala / sbt项目下载的版本完全不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.