Scott Palmer
07/17/2025, 3:17 PMplugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
id("dev.panuszewski.typesafe-conventions") version "0.7.3"
}
./build-logic/build.gradle.kts:
plugins {
`kotlin-dsl`
}
kotlin {
jvmToolchain(21)
}
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
implementation(libs.commons.lang3)
}
./settings.gradle:
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}
// This is to propagate the backendPlatformVersion property to the build-logic convention plugin
gradle.beforeProject { project ->
if (project.hasProperty('backendPlatformVersion')) {
System.setProperty('backendPlatformVersion', project.backendPlatformVersion)
}
}
rootProject.name = 'main-project'
includeBuild("build-logic")
include 'sub-project-1'
include 'sub-project-2
include 'sub-project-3'
When I build with JAVA_HOME pointing to JDK 17:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':sub-project-1'.
> Could not resolve all dependencies for configuration 'classpath'.
> Could not resolve project :build-logic.
Required by:
project :sub-project-1
> Dependency requires at least JVM runtime version 21. This build uses a Java 17 JVM.
Shouldn't the resolver plugin cause the build to use JDK 21?ephemient
07/17/2025, 3:19 PMScott Palmer
07/17/2025, 3:21 PMephemient
07/17/2025, 3:21 PMVampire
07/17/2025, 3:30 PMbuild-logic/build.gradle.kts
actually?
Does the build logic built in there really need Java 21?
If so, then, well, you also need to run the consuming build with Java 21 or use the daemon toolchain feature @ephemient pointed at to run the daemon with 21 even if you start the CLI using 17.
Or did you mean to set the tool chain for your actual production code to 21.
Then the location you did it is wrong and you probably intended to do that in your convention plugin that you apply to your main build.Scott Palmer
07/17/2025, 3:37 PMScott Palmer
07/17/2025, 3:48 PMVampire
07/17/2025, 4:31 PMbuild-logic
project is the Gradle daemon that builds the project that uses those build-logic
things.
If you there configure the target JVM to be 21, then it needs at least JVM 21 for the Gradle daemon.Scott Palmer
07/17/2025, 4:32 PM