From a15e88ba1e97e1c1d07337b1f9d6ca9364d517bb Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 24 Jan 2024 03:35:45 +0100 Subject: [PATCH] [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. --- build.gradle.kts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 7ee2daf7920..070dd1afba7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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("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()) + } } }