Switch to Java 17

Uses the new Java toolchain feature of Gradle to acquire Java 17.

Doing it this way means that you can start ./gradlew under any version
of Java and still use Java 17 for the build; it picks a candidate from
the environment or downloads one if required. It also takes care of
source and target compatibility, with the exception of ide.gradle
which is handled separately.
This commit is contained in:
Ian Young
2022-05-05 13:53:40 +01:00
committed by rstoyanchev
parent 014321240e
commit f91129e24c
2 changed files with 7 additions and 4 deletions

View File

@@ -134,8 +134,11 @@ subprojects { subproject ->
apply from: "${rootProject.projectDir}/publish-maven.gradle"
sourceCompatibility=1.8
targetCompatibility=1.8
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:none"]

View File

@@ -4,8 +4,8 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
apply plugin: "eclipse"
eclipse.jdt {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
}
// Replace classpath entries with project dependencies (GRADLE-1116)