gradle 8.4 release notes:

 > Java 21 is now supported for compiling, testing, and running such projects.


gradle 8.5 release notes:

 > Gradle now supports running on Java 21.


(I fell for it too the first time I read it, Gradle 8.4 can not run on Java 21)

-mbien



On 04.12.23 02:20, Ernie Rael wrote:
On 23/12/03 3:51 PM, Laszlo Kishalmi wrote:
Well, unfortunately gradle init only supports java version specification since Gradle 8.5

NB20 is bundled with Gradle 8.4.

The gradle 8.4 release notes say

    "Java 21 is now supported"

if that matters.


There is a bit workaround needed to run Java 21 projects with Gradle.

I can run the project tests with no workaround.

Also, I manually set the gradle version for the project to 8.5

    ./gradlew wrapper --gradle-version 8.5

The problem icon is still there and the message says

    "Java version: 21 ... not supported by Gradle 8.5"

Both 8.4 and 8.5 claim to support JDK-21. This all makes no sense.

I think (I don't remember) that I could run the project tests when it was gradle 8.4 as well with no workaround.

This all makes me wonder if there's something hardcoded in NetBeans about JDK-21 and gradle.

-ernie



Set the Java Runtime version for Gradle in Tools > Options > Java > Gradle to Java 20 or below.

From there you can use any Java version in your Gradle projects, whatever that Gradle version support.

Gradle 8.4 does support Java 21 using Java Toolchain, should work.

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

On 12/3/23 13:30, Ernie Rael wrote:
Running NB-20, jdk21.

The goal is to play with some JDK-21 APIs...

Creating a project using NB's "New Project > Java with Gradle".

I can build and run the default "Library" and test. But there's the warning icon and "Resolve Project Problems".

Any way to get rid of the warning?

-ernie


"Resolve Project Problems"

The Java version: 21, that is selected for the project is not supported by
Gradle 8.4.The IDE will attempt to use Gradle 8.4 to gather the project
information.
Possible solutions:
Upgrade your Gradle version on your project
Select Java Runtime 20 (or below), on Build > Gradle Execution settings, to avoid this problem!




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Reply via email to