I am trying to create a project using JDK 9, since using the --release argument for javac means that it can create older versions without having to install the appropriate JDK / JRE. I need to support Java 6, so my preconfiguration requires Java 6 for bootstrapClasspath and another JDK 8 or 9 for gradle and IDE. I would like to eliminate JDK 6 in favor of just using 9 and a bit of embellishment.
My new build.gradle has the following configuration:
tasks.withType(JavaCompile) { options.compilerArgs.addAll(['--release', '6', "-Xlint"]) }
The sourceCompatibility , targetCompatibility and bootstrapClasspath targetCompatibility not set, as I understand that the --release argument --release processing this now.
I get the following warnings:
warning: [options] source value 1.6 is obsolete and will be removed in a future release warning: [options] target value 1.6 is obsolete and will be removed in a future release warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
I know that they can be suppressed (he says it right there), but I did not expect to see them. When building with --release [7-9] these warnings are absent.
For context, this is the old (not used) 2x JDK configuration:
sourceCompatibility = "1.6" targetCompatibility = "1.6" tasks.withType(JavaCompile) { options.bootstrapClasspath = new SimpleFileCollection(Arrays.asList(new File("$JDK6_HOME/jre/lib/rt.jar"))) }
Am I setting compiler arguments incorrectly? Is there a way to not set / unset source and target ?
java java-9 release-management gradle java-10
Sam
source share