Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does sbt download a different Scala version than the one in build.sbt?

Tags:

scala

sbt

The build.sbt already set

scalaVersion := "2.11.7"

However, whenever i run sbt where the build.sbt resides, I always get this error

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

Getting Scala 2.10.5 (for sbt)...

Now I cannot proceed. I am running in my macbook.

like image 942
iPhoneJavaDev Avatar asked Aug 13 '16 16:08

iPhoneJavaDev


Video Answer


1 Answers

sbt and your application (managed by sbt) have different requirements for Scala. They both Scala applications so they surely need a Scala runtime.

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. You cannot change the Scala version for sbt. It's "burried" in the code and not something users should change.

Your Scala/sbt projects can however use whatever they want for Scala. It's a separate concern. You can use build.sbt and scalaVersion to set your Scala version.

Having said that, at the very beginning, sbt will always download its own internal dependencies, Scala including. It is then saved in ~/.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. You should not be concerned with that. Just accept it :)

p.s. 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.

like image 134
Jacek Laskowski Avatar answered Oct 12 '22 23:10

Jacek Laskowski