Gradle 2.14 deprecating java 6 as runtime


(Daniel Svojanovský) #1

Hi,

Support for running Gradle on Java 6
Running Gradle using Java 6 is now deprecated, and support will be removed in Gradle 3.0.

It will continue to be possible to build JVM based projects for Java 6, by running Gradle using Java 7 and configuring Gradle to use Java 6 to compile, test and run your code.

AFAIK there is no way how to specify compiler for scala and groovy. How this is going to work?

Thanks.


(Stefan Wolf) #2

Hi.

The compiler for Groovy and Scala is inferred from the Groovy/Scala library on the classpath but can also bet set explicitely (see https://docs.gradle.org/current/userguide/scala_plugin.html#sec:configure_scala_classpath and https://docs.gradle.org/current/userguide/groovy_plugin.html -> DependencyManagement).

Additionally, the sourceCompatibility and targetCompatibility need to be set to the correct version for the Groovy and Scala Compiler to generate Class files of the correct version.


(Daniel Svojanovský) #3

I quite don’t understand how groovy library affects the java runtime? Setting target compatibility is not the same thing as using specific compiler/jdk. At least not for me.

The thing is that for java I can set this:

tasks.withType(AbstractCompile) { options.forkOptions.executable = /my/path/to/java1.8/bin/javac options.bootClasspath = fileTree("/my/path/to/java1.6/jre/lib") { include '*.jar' }.asPath() }

Unfortunately, I can do whatever I want but the JAVA_HOME will be used to actually run the compilers and I really don’t see any way to specify how the bootclasspath should look like (against what libraries I want to compile my code).


(Stefan Wolf) #4

You are right: You cannot set the bootclasspath for the Scala and Groovy compiler via Gradle. This is only an issue if you depend in the Groovy/Scala code on an incompatibility between the JDKs.
At some point in the future the new Java Software Model will support toolchains different from the current JDK for Scala/Groovy.


(Daniel Svojanovský) #5

Thanks for confirmation about the software model, I kindof hoped that it will be possible with some “toolchain” tweaks.