Skip to content

Commit f91129e

Browse files
iayrstoyanchev
authored andcommitted
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.
1 parent 0143212 commit f91129e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

build.gradle

+5-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,11 @@ subprojects { subproject ->
134134

135135
apply from: "${rootProject.projectDir}/publish-maven.gradle"
136136

137-
sourceCompatibility=1.8
138-
targetCompatibility=1.8
137+
java {
138+
toolchain {
139+
languageVersion = JavaLanguageVersion.of(17)
140+
}
141+
}
139142

140143
[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:none"]
141144

ide.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
44
apply plugin: "eclipse"
55

66
eclipse.jdt {
7-
sourceCompatibility = 1.8
8-
targetCompatibility = 1.8
7+
sourceCompatibility = 17
8+
targetCompatibility = 17
99
}
1010

1111
// Replace classpath entries with project dependencies (GRADLE-1116)

0 commit comments

Comments
 (0)