Skip to content

chore: avoid Java version mismatch (alternative mix of Java 8 & Java 11) #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,28 @@ allprojects {
tasks.configureEach<Test> {
val javaToolchains = project.extensions.getByType<JavaToolchainService>()
useJUnitPlatform()
javaLauncher.set(javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(11)) })
// run core tests on Java 8
// toolchain resolver plugin will download Java 8 if not installed
if (project.name == "core") {
javaLauncher.set(
javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(8)) }
)
} else {
javaLauncher.set(
javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(11)) }
)
}
testLogging { exceptionFormat = TestExceptionFormat.FULL }
}
tasks.withType<JavaCompile> {
sourceCompatibility = "17"
if (project.name != "core") {
options.release.set(11)
if (project.name == "core") {
options.release = 8
} else {
options.release.set(8)
options.release = 11
}
// use a Java 17 to compile code, will download Java 17 if not installed
javaCompiler = javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(17) }
dependsOn(submodulesUpdate)
}

Expand Down
5 changes: 5 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ pluginManagement {
kotlin("jvm") version "kotlin".v()
}
}

plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id("org.gradle.toolchains.foojay-resolver-convention").version("1.0.0")
}
2 changes: 1 addition & 1 deletion spark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ java {

tasks.withType<ScalaCompile>() {
targetCompatibility = ""
scalaCompileOptions.additionalParameters = listOf("-release:17")
scalaCompileOptions.additionalParameters = listOf("-release:11")
}

var SLF4J_VERSION = properties.get("slf4j.version")
Expand Down
Loading