Skip to content

Commit ab014af

Browse files
build: use Gradle Java toolchain to provision JDK 17
The shared hypertrace gradle GitHub action launches Gradle with JDK 11 on the runner. Setting source/target compatibility to 17 caused 'invalid source release: 17' on subprojects in the build job. Switching to a Java toolchain lets Gradle auto-provision and compile with JDK 17 regardless of the launcher JDK the action uses.
1 parent 43cd165 commit ab014af

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

build.gradle.kts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ subprojects {
2121

2222
pluginManager.withPlugin("java") {
2323
configure<JavaPluginExtension> {
24-
sourceCompatibility = JavaVersion.VERSION_17
25-
targetCompatibility = JavaVersion.VERSION_17
24+
// Use a Gradle toolchain so the build provisions and compiles with JDK 17
25+
// regardless of the launcher JDK the CI action uses (the shared
26+
// hypertrace gradle action launches with JDK 11).
27+
toolchain {
28+
languageVersion.set(JavaLanguageVersion.of(17))
29+
}
2630

2731
apply(plugin = "org.hypertrace.code-style-plugin")
2832
}

0 commit comments

Comments
 (0)