[build] Pass/override JDK_1_8 env variable to maven exec tasks

While other JDKs can be used in the maven build,
only JDK_1_8 is required for 'install' and 'deploy' goals without tests.

Provide this path from the corresponding toolchain discovered by Gradle.
This commit is contained in:
Ilya Gorbunov
2024-01-24 03:35:45 +01:00
committed by Space Team
parent 6e763f5c41
commit a15e88ba1e
+7
View File
@@ -47,6 +47,7 @@ plugins {
if (kotlinBuildProperties.isKotlinNativeEnabled) {
id("kotlin.native.build-tools-conventions") apply false
}
`jvm-toolchains`
}
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
@@ -987,6 +988,9 @@ tasks {
group = "publishing"
workingDir = rootProject.projectDir.resolve("libraries")
commandLine = getMvnwCmd() + listOf("clean", "install", "-DskipTests")
doFirst {
environment("JDK_1_8", getToolchainJdkHomeFor(JdkMajorVersion.JDK_1_8).get())
}
}
register<Exec>("mvnPublish") {
group = "publishing"
@@ -997,6 +1001,9 @@ tasks {
"-Ddeploy-snapshot-repo=local",
"-Ddeploy-snapshot-url=file://${rootProject.projectDir.resolve("build/repo")}"
)
doFirst {
environment("JDK_1_8", getToolchainJdkHomeFor(JdkMajorVersion.JDK_1_8).get())
}
}
}