keeganwitt / docker-gradle

Docker images with Gradle
https://hub.docker.com/_/gradle/
Apache License 2.0
147 stars 73 forks source link

Java 21 Image #260

Closed pipinet closed 1 year ago

sergey-morenets commented 1 year ago

Hi

Do you have any updates/ETA for this issue? JDK 21 was released 3 weeks ago. Gradle 8.4 was released 5 days ago. However Dockerfile here still uses JDK 20.

keeganwitt commented 1 year ago

All I know about it is here: https://github.com/adoptium/containers/issues/427.

I can't release it until they do.

keeganwitt commented 1 year ago

They released the images for 21 today.

But another problem: Gradle doesn't support it yet. Similar to the issue we had with Java 20 (#247).

keeganwitt commented 1 year ago

I'll merge the new images, but they won't be published until Gradle announces support for Java 21. Please reply to this thread if you require an image that has both Java 17 (for launching Gradle) and Java 21 for use in compilation via a toolchain.

keeganwitt commented 1 year ago

265 creates images with both Java 17 and 21. If that's needed by anyone, let me know. This is a bit better situation than what we had with Java 20 because at least both versions are LTS releases.

floriandreher commented 1 year ago

265 creates images with both Java 17 and 21. If that's needed by anyone, let me know. This is a bit better situation than what we had with Java 20 because at least both versions are LTS releases.

It would be cool to have this image :)

sergey-morenets commented 1 year ago

265 creates images with both Java 17 and 21. If that's needed by anyone, let me know. This is a bit better situation than what we had with Java 20 because at least both versions are LTS releases.

It would be cool to have this image :)

For me as well. Gradle already claimed support for JDK 21 (if you use Gradle 8.4 and Groovy scripts).

floriandreher commented 1 year ago

For me as well. Gradle already claimed support for JDK 21 (if you use Gradle 8.4 and Groovy scripts).

So is JDK 21 fully supported for using build.gradle groovy setup? If this is true, can't be the plain JDK 21 image be published and be used for projects using groovy setup?

keeganwitt commented 1 year ago

For me as well. Gradle already claimed support for JDK 21 (if you use Gradle 8.4 and Groovy scripts).

So is JDK 21 fully supported for using build.gradle groovy setup? If this is true, can't be the plain JDK 21 image be published and be used for projects using groovy setup?

Not that I've seen. If someone can point to somewhere Gradle has stated this, I'll publish the 21 images.

sergey-morenets commented 1 year ago

For me as well. Gradle already claimed support for JDK 21 (if you use Gradle 8.4 and Groovy scripts).

So is JDK 21 fully supported for using build.gradle groovy setup? If this is true, can't be the plain JDK 21 image be published and be used for projects using groovy setup?

Not that I've seen. If someone can point to somewhere Gradle has stated this, I'll publish the 21 images.

Here's notes from 8.4 official release:

Gradle now supports [using Java 21](https://docs.gradle.org/8.4/userguide/compatibility.html#java) for compiling, testing, and starting other Java programs. This can be accomplished using [toolchains](https://docs.gradle.org/8.4/userguide/toolchains.html).

Currently, you cannot run Gradle on Java 21 because Kotlin lacks support for JDK 21. However, support for running Gradle with Java 21 is expected in future versions.

So I couldn't find anything about impossibility to build apps using Groovy scripts. FYI, I tested locally Gradle 8.4, JDK 21 and app with Kotlin build scripts and build was successful.

keeganwitt commented 1 year ago

For me as well. Gradle already claimed support for JDK 21 (if you use Gradle 8.4 and Groovy scripts).

So is JDK 21 fully supported for using build.gradle groovy setup? If this is true, can't be the plain JDK 21 image be published and be used for projects using groovy setup?

Not that I've seen. If someone can point to somewhere Gradle has stated this, I'll publish the 21 images.

Here's notes from 8.4 official release:

Gradle now supports [using Java 21](https://docs.gradle.org/8.4/userguide/compatibility.html#java) for compiling, testing, and starting other Java programs. This can be accomplished using [toolchains](https://docs.gradle.org/8.4/userguide/toolchains.html).

Currently, you cannot run Gradle on Java 21 because Kotlin lacks support for JDK 21. However, support for running Gradle with Java 21 is expected in future versions.

So I couldn't find anything about impossibility to build apps using Groovy scripts. FYI, I tested locally Gradle 8.4, JDK 21 and app with Kotlin build scripts and build was successful.

I thought it meant because Gradle itself depends on Kotlin, they aren't able to make Gradle itself support Java 21 until Kotlin does. At least that seemed to be the consensus in the issue about Java 20. But looking at https://github.com/gradle/gradle/pull/25777, it looks like they just bumped the asm version and I don't understand why that alone would break the ability to run Gradle on a newer JVM.

Edit: https://github.com/gradle/gradle/issues/25574#issuecomment-1734054861 confirms from a Gradle employee that as long as you're not using Kotlin build scripts, it's supposed to work.

Silly question from me, but as far as we're using Groovy DSL only, isn't possible to deactivate the kotlin part and run 8.3 on JDK21?

In theory this should work without any changes to Gradle, i.e. as long as you don't have any Kotlin buildscripts, it should work as-is.

sergey-morenets commented 1 year ago

So will you push new Docker image ?

keeganwitt commented 1 year ago

So will you push new Docker image ?

I'm doing some experimenting first. Gradle has stated that Kotlin scripts don't work with 21, but in my testing, it has worked. So, I'm confused what the limitations actually are.

keeganwitt commented 1 year ago

Here's the Java 21 Gradle issue: https://github.com/gradle/gradle/issues/25574 There's also one for Java 22: https://github.com/gradle/gradle/issues/26162 My understanding is https://youtrack.jetbrains.com/issue/KT-58987 should prevent this in the future (starting with Kotlin 1.9.20 once Gradle upgrades to that).

keeganwitt commented 1 year ago

Ah, it's usages of the kotlin-dsl plugin that don't work, as demonstrated in #266. I think as long as we document clearly what the limitations are, it's OK to publish the 21 images.

keeganwitt commented 1 year ago

Official images PR: https://github.com/docker-library/official-images/pull/15537

sergey-morenets commented 1 year ago

@keeganwitt Thank you a lot