[ant:scalac] scala.reflect.internal.FatalError: trait Context does not have a member reify


(Shawn Garner) #1

I’m getting an error running gradle build command: [ant:scalac] scala.reflect.internal.FatalError: trait Context does not have a member reify I’m building akka basic PI example (http://doc.akka.io/docs/akka/2.0.2/intro/getting-started-first-scala.html) using eclipse and it compiles and runs fine in eclipse. However when I run gradle via the command prompt it fails and I do not know why. I’m using the same versions in both places some I’m confused as to what the issue with Gradle is.

I’m using Gradle 1.1 and here is my dependencies:

dependencies {
 // Libraries needed to run the scala tools
 scalaTools 'org.scala-lang:scala-compiler:2.10.0-M5'
 scalaTools 'org.scala-lang:scala-library:2.10.0-M5'
 scalaTools 'org.scala-lang:scala-actors:2.10.0-M5'
 scalaTools 'org.scala-lang:scala-reflect:2.10.0-M5'
 // Libraries needed for scala api
 compile 'org.scala-lang:scala-library:2.10.0-M5'
 compile 'org.scala-lang:scala-actors:2.10.0-M5'
 compile 'org.scala-lang:scala-reflect:2.10.0-M5'
 compile 'com.typesafe.akka:akka-actor:2.1-M1'
 compile 'com.typesafe:config:0.5.0'
}

(Peter Niederwieser) #2

The ‘scalaTools’ configuration should only contain ‘scala-compiler’. The compiler’s dependencies will be pulled in automatically, and ‘scala-actors’ is probably not one of them.

As for the compile error, according to the akka homepage, akka 2.1-M1 requires (and probably pulls in) Scala 2.10.0-M6. In such situations, it’s always worth to check the output of ‘gradle dependencies’.


(Shawn Garner) #3

That worked to change gradle to 2.10.0-M6. Now I’m even more confused why Eclipse compiled and ran because Eclipse says it has scala 2.10.0-M5.


(Peter Niederwieser) #4

Probably because you only used M5 artifacts in Eclipse, but a mix of M5 and M6 artifacts in Gradle (due to transitive dependency management).