benstpierre
benstpierre

Reputation: 33591

How can I force which Scala version SBT should use?

I keep getting the error

Error while loading AnnotatedElement, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar(java/lang/reflect/AnnotatedElement.class)' is broken

When running SBT against my project. It appears this error is due to this problem with Scala 2.10 not working with JDK 8. I do have scala 2.11 set and my SCALA_HOME points to Scala 2.11 at "SCALA_HOME=/Library/Scala/scala-2.11.2".

So any idea how to force SBT to use this version or check what version it is currently trying to use?

Upvotes: 4

Views: 1647

Answers (2)

frostmatthew
frostmatthew

Reputation: 3298

In your Build.sbt change the Scala version specified to the version you want (it defaults to what SBT was built with)

scalaVersion := "2.11.2"

http://www.scala-sbt.org/release/docs/Howto-Scala.html

Upvotes: 3

bjfletcher
bjfletcher

Reputation: 11518

Add to the build.sbt this line:

scalaVersion := "2.11.2"

Upvotes: 1

Related Questions