-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use 'Toolchains for JVM projects' of Gradle 6.7+ #1187
Comments
Thanks for the suggestion, but I don't think we should do this. Using Gradle's Toolchain support may result in it attempting to download a JDK to meet the project's needs. That's something that may not always be desirable and in some organisations it wouldn't be permitted. I think it's better if we leave it as an opt-in. Let's see what the rest of the team thinks. |
Cool, I think it will also be great if the feature added as opt-in. Thanks for your reply. |
To be clear, I meant an opt-in once the project has been generated. We certainly won't add it as an option when generating a project as we don't want to overwhelm users with too much choice. We'll either implement it for all Gradle projects or it'll be a change that you can make yourself once the project has been generated. |
Ok I see. |
As Andy mentioned, we really need to add what is strictly necessary out-of-the-box and let users complete their build with additional options if necessary. Thanks for the suggestion, in any case. |
I come to this issue from a broken Java 21 project (Gradle 8.4):
I don't follow the reasoning provided for declining this issue: from what I can tell, automatically downloading JDKs is opt-in from Gradle's POV. A toolchain download repository must be explicitly configured for any download to happen. I would argue that if such a repository is added to the config by the user, their intention is clear. My use case is admittedly somewhat niche as it should disappear when Gradle 8.5 is released, but I wanted to add another vote for toolchain support in favor of the current sourceCompatibility approach. |
That, and I am not sure you should get that issue in the first place. It looks like your shell is not using Java 21. What does |
You are correct, my shell was using Java 17. |
Gradle 6.7 introduced 'Toolchains for JVM projects'.
Reference: https://docs.gradle.org/6.8.2/userguide/toolchains.html
So my suggestion is changing
sourceCompatibility
to:initializr/initializr-generator/src/main/java/io/spring/initializr/generator/buildsystem/gradle/GroovyDslGradleBuildWriter.java
Lines 89 to 92 in 835f699
initializr/initializr-generator/src/main/java/io/spring/initializr/generator/buildsystem/gradle/KotlinDslGradleBuildWriter.java
Lines 83 to 86 in 8cef356
The text was updated successfully, but these errors were encountered: