Incoherent scala library version

I have a warning that leads to a runtime error:

[info] Set current project to calculator (in build file:/home/guillaume/projects/scala/2/) [info] Updating {file:/home/guillaume/projects/scala/2/}root... [info] Resolving org.fusesource.jansi#jansi;1.4 ... [info] Done updating. [warn] Scala version was updated by one of library dependencies: [warn] * org.scala-lang:scala-library:2.10.5 -> 2.11.1 [warn] To force scalaVersion, add the following: [warn] ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) } [warn] Run 'evicted' to see detailed eviction warnings [info] Compiling 3 Scala sources to /home/guillaume/projects/scala/2/target/scala-2.10/classes... [success] Total time: 9 s, completed Apr 5, 2016 12:16:04 AM 

This is strange because my version of scala is> 2.11:

 $ scala -version Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL $sbt sbtVesion [info] 0.13.9 

My build.sbt:

 lazy val root = (project in file(".")). settings( name := "calculator", libraryDependencies += "jline" % "jline" % "2.12", libraryDependencies += "com.typesafe.akka" % "akka-actor_2.11" % "2.3.4" ) 

I just don't understand why my scala library is deprecated.

+5
source share
1 answer

The Scala version used by your SBT build is determined by your SBT configuration, not your Scala system. The default version of Scala for SBT 0.13 is 2.10, but you can change it with the following setting in build.sbt :

 scalaVersion := "2.11.8" 

The fact that the version of your SBT Scala project does not depend on your version of Scala (if any) is actually very convenient - that means you can have projects that cross-build for several Scala, which you can create projects on machines, on which Scala is not installed, etc.

Another note - it is recommended to avoid such a mismatch by using the %% syntax for Scala dependencies - for example. this is:

 libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.4" 

Instead of this:

 libraryDependencies += "com.typesafe.akka" % "akka-actor_2.11" % "2.3.4" 

%% before the artifact name says: "Use this name, but suffix it with _<Scala epoch version>.<Scala major version> for any current version of Scala."

+14
source

Source: https://habr.com/ru/post/1246435/


All Articles