Reputation: 17118
Just trying to create a Gradle project using the jdk17, facing the below issue. I know Gradlew 7.3 is required for JDK 17, but quite not sure from where I should set the version of Gradle
Gradle location
Gradle version
Upvotes: 11
Views: 27682
Reputation: 565
It's because the current version of IntelliJ (2021.2.3) is not aware of gradle 7.3.
To get around the issue:
distributionUrl
in gradle/wrapper/gradle-wrapper.properties
to https\://services.gradle.org/distributions/gradle-7.3-bin.zip
.After you refresh the project it should be able to build.
Upvotes: 11
Reputation: 939
I'm not sure which version of IntelliJ you're using, it maybe ships with Gradle 7 version. In my case also 7 version, but after creating project, just set gradle 7.3 location in preference. For me, gradle 7.3 builds JDK 17 successfully.
Upvotes: 0
Reputation: 23017
I somehow got Java 17 with Gradle 7.2 working (with IntelliJ IDEA 2021.2.2 Community Edition and Windows 10).
I had Gradle 7.2 installed separately. This is what I configured within IntelliJ:
17
Specified location
and select the path to Gradle 7.2.You could also try to explicitly set the Java language version within build.gradle
:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
Upvotes: 3
Reputation: 6470
I've reproduced the same issue:
Unsupported Project JDK
Cannot find supported Gradle version for JDK 17. The Gradle supports JDK versions 7 through 16.
using Java 17
& Gradle 7.3
& Windows 10
.
But, as I see from matrix of compatibility, there must be no issue with Java 17
& Gradle 7.3
:
As temporary workaround it can be solved using Java 15 instead of Java 17
with Gradle 7.3
, but for me it looks like a bug related to Intellij IDEA 2021.2.2 (Ultimate Edition | Build #IU-212.5284.40, built on September 14, 2021)
+ Java 17
, so I opened a ticket on YT:
Cannot find supported Gradle version for JDK 17. The Gradle supports JDK versions 7 through 16.
Also I've reproduced the same issue using versions of Gradle
:
5.6.4
, 6.1
, 7.1
, 7.3
with Java 17
in Intellij IDEA
until I downgraded to Java 15
.
To be noticed: this is a bug which is specifically related to Java 17
+ Intellij IDEA 2021.2.2 (Ultimate Edition | Build #IU-212.5284.40, built on September 14, 2021)
and it's not related to GRADLE_HOME
+ GRADLE_HOME/bin
.
Upvotes: 4
Reputation: 16401
The 2021.2 IDE version uses 7.2 Gradle version for new projects. At the moment of that IDE version release, there was no Gradle version that supported 17 JDK version. Now, you can update to 2021.3 IDE version where the Gradle version has been updated to 7.3 which now supports 17 JDK. The preview build is available from this page.
Upvotes: 0
Reputation: 349
Assuming that you're looking to switch versions of gradle, the best way forward is to use a version manager.
I personally use sdkman which is Open source and provides support for major tools like Java, Maven, Gradle and others.
The benefit is you can install multiple versions and switch between them without dealing with env vars.
# installing
$ sdk install gradle 6.7.1
# switching version
$ sdk use gradle 6.7.1
# set as default version
$ sdk default gradle 6.7.1
Upvotes: 0