Reputation: 8175
It even though I have scalaVersion set to 2.11.7, my project wants to build with Scala 2.10.x.
Every time I recompile a new directory src/main/scala2.10 appears in my project. I'm pretty sure that this must be the result of an SBT reconfiguration, but what exactly is causing this, and how do I fix it?
I have a very simple [project_root]/build.sbt file:
name := "coolproduct"
version := "0.0.1"
lazy val scalaVersion = "2.11.7"
lazy val akkaVersion = "2.4.1"
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % akkaVersion
When I run this script it seems to be trying to use Scala 2.10 - a totally different version to what I actually asked for:
> sbt compile
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\salim\workspace\funproxy\project
[info] Set current project to funproxy (in build file:/C:/Users/salim/workspace/funproxy/)
[info] Updating {file:/C:/Users/salim/workspace/funproxy/}funproxy...
[info] Resolving com.typesafe.akka#akka-actor_2.10;2.4.1 ...
[warn] module not found: com.typesafe.akka#akka-actor_2.10;2.4.1
[warn] ==== local: tried
[warn] C:\Users\salim\.ivy2\local\com.typesafe.akka\akka-actor_2.10\2.4.1\ivys\ivy.xml
[warn] ==== jcenter: tried
[warn] https://jcenter.bintray.com/com/typesafe/akka/akka-actor_2.10/2.4.1/akka-actor_2.10-2.4.1.pom
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/akka/akka-actor_2.10/2.4.1/akka-actor_2.10-2.4.1.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.akka#akka-actor_2.10;2.4.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.typesafe.akka:akka-actor_2.10:2.4.1 (C:\Users\salim\workspace\funproxy\build.sbt#L22-23)
[warn] +- default:funproxy_2.10:0.0.1
I'm running an up to date version of SBT:
> sbt about
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\salim\workspace\funproxy\project
[info] Set current project to funproxy (in build file:/C:/Users/salim/workspace/funproxy/)
[info] This is sbt 0.13.8
[info] The current project is {file:/C:/Users/salim/workspace/funproxy/}funproxy 0.0.1
[info] The current project is built against Scala 2.10.4
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.4
Upvotes: 0
Views: 414
Reputation: 8463
The short answer: change lazy val scalaVersion = "2.11.7"
to:
scalaVersion := "2.11.7"
scalaVersion
is not just a local scala var
(or val
) you can override; it's defined internally as a Key (see Keys). With the :=
operation you're changing the internal state of that key.
Upvotes: 2