Skip to content

Commit e2fc5b6

Browse files
authored
Compile against Java 8 tools jar
1 parent a827001 commit e2fc5b6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

build.gradle.kts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ val javacExports = listOf(
1717
"jdk.compiler/com.sun.tools.javac.util",
1818
)
1919

20+
val java8Compiler = javaToolchains.compilerFor {
21+
languageVersion = JavaLanguageVersion.of(8)
22+
}
23+
2024
dependencies {
25+
compileOnly(files(java8Compiler.map { it.metadata.installationPath.file("lib/tools.jar") }))
2126
testImplementation(libs.junit.jupiter)
2227
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
2328
}
@@ -30,9 +35,7 @@ java {
3035
}
3136

3237
tasks.named<JavaCompile>("compileJava") {
33-
javaCompiler = javaToolchains.compilerFor {
34-
languageVersion = JavaLanguageVersion.of(8)
35-
}
38+
javaCompiler = java8Compiler
3639
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
3740
targetCompatibility = JavaVersion.VERSION_1_8.toString()
3841
}

0 commit comments

Comments
 (0)