Ant:scalac using target jvm-1.5


(Monosij Dutta-Roy) #1

Question: Is there a way to change the JDK version being used by scalac? On Ubuntu 12.10, JDK 7 | Scala version: 2.10.0 | Gradle 1.3 … When I run build, don’t get any errors but get the warning: :compileScala [ant:scalac] warning: -target:jvm-1.5 is deprecated: use target for Java 1.6 or above. [ant:scalac] one warning found … build file has Scala dependencies as:

scalaTools ‘org.scala-lang:scala-compiler:2.10.0’

compile ‘org.scala-lang:scala-library:2.10.0’ … gradle -v gives: Gradle build time: Tuesday, November 20, 2012 11:37:38 AM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.7.0_09 (Oracle Corporation 23.2-b09) OS: Linux 3.5.0-21-generic amd64 … Thank you for your help.


(Travis Gockel) #2

The Gradle ANT task for scalac doesn’t appear to respect global targetCompatibility…I couldn’t trace down the exact issue, but did come up with this workaround:

tasks.withType(ScalaCompile) {

scalaCompileOptions.additionalParameters = [’-target:jvm-1.6’]

}


(Peter Niederwieser) #3

Until Scala 2.10, the ‘scalac’ Ant task only supported ‘jvm-1.5’ (and ‘msil’). Starting with Gradle 1.3 and Scala 2.10, ‘targetCompatibility’ should take effect (otherwise it’s a bug).


(Peter Niederwieser) #4

I just discovered that there was a bug in determining the Scala version. This is now fixed, and the “correct” target value should be set for Scala 2.10 and above.


(Travis Gockel) #5

Did that make it into 1.4?


(Peter Niederwieser) #6

No it didn’t. Note that the problem only exists for the Ant compiler support, but not for the new Zinc compiler support.


(Peter Niederwieser) #7

Fixed in 1.5.


(dpb) #8

Shouldn’t the bug be marked resolved, then?


(Peter Niederwieser) #9

Usually it happens automatically, but apparently it didn’t this time.