Closed keeganwitt closed 1 year ago
This can be used with
Groovy DSL
java {
toolchain {
languageVersion = JavaLanguageVersion.of(20)
}
}
kotlin {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(20)
}
}
or Kotlin DSL
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(20))
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(20))
}
}
And invoke gradle with these args
-Porg.gradle.java.installations.auto-detect=false
-Porg.gradle.java.installations.auto-download=false
-Porg.gradle.java.installations.fromEnv=JAVA20_HOME
# you could use the below line instead of the above line
-Porg.gradle.java.installations.paths=/opt/java/openjdk20
These properties could be set inside .gradle/gradle.properties, so that they are automatically read and used by the gradle command
These properties could be set inside .gradle/gradle.properties, so that they are automatically read and used by the gradle command
That's true, but I thought that would be inconvenient for running your project locally.
What I meant was to set these properties inside the docker image, so that only when running gradle from the image the toolchain whould be manually set. I don't think it will impact using gradle locally
What I meant was to set these properties inside the docker image, so that only when running gradle from the image the toolchain whould be manually set. I don't think it will impact using gradle locally
Oh, with GRADLE_OPTS
?
I was actually thinking about creating a file inside the docker image, but an ENV is also a good option
Does anyone have a need for this image? Should we go forward with creating it?
We're currently stuck on an old jdk19/gradle8.0 build of docker-gradle. We're using jdk19 and want to upgrade to jdk20 and Gradle 8.2, but can't due a build with jdk20 is missing.
@MartelliEnrico I see which file you mean now (I originally thought you meant the project's .gradle directory). That is a good suggestion. since that will make it less likely to be accidentally wiped out by people setting their own GRADLE_OPTS
.
@jurriaan I held off on making another image I'd have to maintain because I wasn't sure anyone needed this. Now that you said you do, I'll proceed with merging it.
@keeganwitt JDK20 is supported with Kotlin 1.9.0, right? Am I correct that this JDK 17 + 20 approach isn't needed anymore when https://github.com/gradle/gradle/pull/25777 is merged? Maybe we can wait for that instead of releasing this combined image?
@keeganwitt JDK20 is supported with Kotlin 1.9.0, right? Am I correct that this JDK 17 + 20 approach isn't needed anymore when gradle/gradle#25777 is merged? Maybe we can wait for that instead of releasing this combined image?
That's right, but there hasn't been a version of Gradle released that is on Kotlin 1.9.0. The last I saw in the linked issue, it will be shipped in Gradle 8.3.
I'd rather wait, since then we won't have the confusion of when this new image is EOL, but it's really up to whatever people need.
8.3 just got released this morning!
https://docs.gradle.org/8.3/release-notes.html#full-support-for-java-20
The latest (8.1.1) release notes say
They also note this in their compatibility guide.
My hope was that full Java 20 support was coming soon, but it sounds like it might not be until 8.2 (July). See the issue https://github.com/gradle/gradle/issues/23488.
This PR adds an image based on the Java 17 image but also installs Java 20 so that you can use it in a toolchain.