Sherrloc is imported to our Gradle build via ant.importBuild, which allows us to configure Gradle targets to relate to ant tasks:
|
ant.importBuild("sherrloc/GenErrorDiagnostic/build.xml") { |
|
antTargetName -> "slc-" + antTargetName |
|
} |
|
compileJava.configure { |
|
dependsOn("slc-jar") |
|
} |
We configure Gradle to use the Java 21 toolchain, which means that Gradle will use Java 21 for its tasks, like running and building the application:
|
java { |
|
toolchain { |
|
languageVersion = JavaLanguageVersion.of(21) |
|
} |
|
} |
When running or building the project with the Gradle wrapper, Gradle will thus output compiled class files for Java 21 and use the Java 21 runtime to run the application. Unfortunately, it seems Ant will compile using the system's global Java version. My java is openjdk 23.0.1 2024-10-15, so sherrloc is compiled with class version 67 (Java 23).
Exception in thread "main" java.lang.UnsupportedClassVersionError: sherrloc/constraint/parse/parser has been compiled by a more recent version of the Java Runtime (class file version 67.0), this version of the Java Runtime only recognizes class file versions up to 65.0
Sherrloc is imported to our Gradle build via ant.importBuild, which allows us to configure Gradle targets to relate to ant tasks:
SCIF/build.gradle
Lines 18 to 20 in f7105a0
SCIF/build.gradle
Lines 59 to 61 in f7105a0
We configure Gradle to use the Java 21 toolchain, which means that Gradle will use Java 21 for its tasks, like running and building the application:
SCIF/build.gradle
Lines 12 to 16 in f7105a0
When running or building the project with the Gradle wrapper, Gradle will thus output compiled class files for Java 21 and use the Java 21 runtime to run the application. Unfortunately, it seems Ant will compile using the system's global Java version. My
javaisopenjdk 23.0.1 2024-10-15, so sherrloc is compiled with class version 67 (Java 23).