Fix wrong toolchain configuration for java17 tests

This commit is contained in:
Christian Beikov 2022-08-30 12:58:07 +02:00
parent d2cca544c2
commit f1c08e8e97
1 changed files with 6 additions and 0 deletions

View File

@ -230,6 +230,9 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 ) {
// For the new source set, we need to configure the source and target version to 17
compileTestJava17Java {
javaCompiler = javaToolchains.compilerFor {
languageVersion = gradle.ext.javaVersions.test.compiler
}
sourceCompatibility = 17
targetCompatibility = 17
// We also depend on the main test resources
@ -250,6 +253,9 @@ if ( gradle.ext.javaVersions.test.release.asInt() >= 17 ) {
// We execute the Java 17 tests in a custom test task
task java17Test(type: Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = gradle.ext.javaVersions.test.launcher
}
useJUnitPlatform()
testClassesDirs = sourceSets.testJava17.output.classesDirs
classpath = sourceSets.testJava17.runtimeClasspath