With gradle 6 and still with gradle 7 i find extra java sdk’s being installed by gradle.
I am using java15 and now 16 in all my projects and have installed these myself. However I still find java13 and java14 installed and referenced from intellij.
I investigated this with intellij support and they say it comes from gradle itself.
The applications I have work perfectly with java15 I dont need java13 on my system.
How do I disable this feature globally so gradle doesnt install sdk’s it ‘thinks I need’ ?
Thanks
Gradle installs versions of the JDK using the Java Toolchains feature. However, it doesn’t just decide that you need Java 13. You would have to run a build that explicitly configures the requirement for that version. For example, if the build contains:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(13)
}
}
This says that if the build is not run with Java 13, and Java 13 is not installed, install it. It doesn’t matter if the project runs fine with Java 15.
You can disable auto-provisioning by putting a property in your Gradle user home gradle.properties
(see Toolchains for JVM projects), but this will just cause your build to fail when the version requested is not available. If you don’t want to enforce using a specific version, you’re better off not configuring Java Toolchains and allowing whatever version you run Gradle with to be used over disabling Toolchain auto-provisioning.
Thanks for your reply I will try the disable auto-provisioning as you suggest
However we have never used the tool-chain features and still find 13 and 14 installed after importing gradle java projects, possibly this is some misconfiguration between intellij and gradle but I dont have enough information to debug further