简体   繁体   中英

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?

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

添加到build.sbt这一行:

scalaVersion := "2.11.2"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM