Org.gradle.java.installations.auto-download

org.gradle.java.installations.auto-download=true

the build script

java {
    toolchain {
	languageVersion.set(JavaLanguageVersion.of(17))
	//vendor.set(JvmVendorSpec.GRAAL_VM)
	//vendor.set(JvmVendorSpec.matching("customString"))
	//implementation.set(JvmImplementation.J9)
    }
}

is not download jdk…

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':test'.
> Could not resolve all dependencies for configuration ':testRuntimeClasspath'.
   > Failed to calculate the value of task ':compileTestJava' property 'javaCompiler'.
      > No matching toolchains found for requested specification: {languageVersion=17, vendor=any, implementation=vendor-specific}.
         > No locally installed toolchains match (see https://docs.gradle.org/8.1.1/userguide/toolchains.html#sec:auto_detection) and toolchain download repositories have not been configured (see https://docs.gradle.org/8.1.1/userguide/toolchains.html#sub:download_repositories).

Auto download is enabled

edu>gradle -q javaToolchains

 + Options
     | Auto-detection:     Disabled
     | Auto-download:      Enabled

 + Eclipse Temurin JDK 11.0.19+7
     | Location:           C:\Users\nagku\.gradle\jdks\eclipse_adoptium-11-amd64-windows\jdk-11.0.19+7
     | Language Version:   11
     | Vendor:             Eclipse Temurin
     | Architecture:       amd64
     | Is JDK:             true
     | Detected by:        Auto-provisioned by Gradle

Since Gradle 8, the auto-provisioning does not work out of the box anymore.
You have to declare where to download toolchains from, for example by applying the foojay plugin as documented at the link given in the error message.

1 Like

Oops… any reason for removing auto download feature… I was thinking it is a good lazy engineering feature…


https://docs.gradle.org/current/userguide/toolchains.html Documentation would need update on the point 4 as it still say it would auto download

Point 4 is perfectly valid.
It will auto-download.
Point 4 is saying “on the configured toolchain download repositories”.
In Gradle 7 there were some hard-coded.
In Gradle 8 you need to configure some, for example using the plugin as documented and also mentioned in my last comment.
Just if you don’t configure any, it does not know where to download from.