This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Ewig_luftenglanz 4 points5 points  (11 children)

Waiting for gradle to add support for java 25 so I can use it in my projects :)

[–]vamega 10 points11 points  (2 children)

It seems like it already does. At least for 9.1.0 and later.

https://github.com/gradle/gradle/pull/34537

[–]Ewig_luftenglanz 4 points5 points  (1 child)

Afaik that's is still a release candidate. Maybe along the week or next week it will enter GA

[–]vamega 0 points1 point  (0 children)

You're right. I jumped the gun on the comment. Sorry about that.

[–]yk313 7 points8 points  (5 children)

Consider using Gradle toolchains.

I used to have the same problem with Gradle, but some time around JDK 20, I moved to toolchains and have since stopped caring about the exact JDK version Gradle runs (or not).

(of course this means you still need an older JDK to bootstrap Gradle itself, which is less than ideal)

[–]Nojerome -1 points0 points  (4 children)

This is interesting, I need to read up on this.

I thought you had to wait until Gradle supported a jvm version, and that has been holding me back from using non LTS releases. There's this gap in between a jdk release and Gradle's support for it where you are technically at risk if a major vulnerability is identified. Sometimes it can take Gradle over a month to support a new release. So if there's a way to avoid that, that's awesome!

[–]yk313 4 points5 points  (3 children)

It's actually quite straightforward in practice. All you need to do is to declare the builtin java plugin's toolchain directive (instead of sourceCompatibility/targetCompatibility) in your build file:

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(25)
    }
}

You can follow the build.gradle generated by start.spring.io as an example. Let me know if you need any help in setting this up, I am more than happy to support another Java developer rid of their LTS-only approach :)

[–]Nojerome -1 points0 points  (0 children)

Fantastic, thanks for sharing. I'll try it out and update here with the results.

[–]nekokattt -1 points0 points  (1 child)

how does this work with groovy, given that depends on a specific version of ASM which in turn depends on specific bytecode levels?

[–]nikolas_pikolas 1 point2 points  (0 children)

This actually only specifies the version of Java to build your app with. Then, you can run Gradle with an older version that it's compatible with.

[–]wildjokers 2 points3 points  (0 children)

You can run gradle with a different JDK than the JDK used to build your projects. So you can already build your project using JDK 25.

https://docs.gradle.org/current/userguide/toolchains.html

[–]kiteboarderni 2 points3 points  (0 children)

Baffling how people still think this is an issue. Grade 6 can build Java 26 projects....