Gradle "Toolchain auto-provisioning is not enabled" in CI
A resolver could provision the requested JDK, but org.gradle.java.installations.auto-download is set to false, so Gradle refuses to download it and fails instead of fetching the toolchain.
What this error means
The build fails with a toolchain message noting "Toolchain auto-provisioning is not enabled" or "auto-download is disabled" when no local JDK matches the request.
> No compatible toolchains found for request specification: {languageVersion=21, ...} (auto-detect false, auto-download false).
Toolchain auto-provisioning is not enabled.Common causes
auto-download was disabled in properties
A gradle.properties (or command line) set org.gradle.java.installations.auto-download=false, so Gradle will not fetch a missing JDK.
auto-detect is off and no JDK path is configured
With auto-detect disabled and no explicit installation path, Gradle sees no local JDK and cannot download one.
How to fix it
Provide the JDK instead of downloading
Install the JDK on the runner so no auto-provisioning is needed, keeping downloads off in CI.
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'Enable auto-download deliberately
If you want Gradle to fetch the JDK, enable auto-download and apply a toolchain resolver.
org.gradle.java.installations.auto-download=trueHow to prevent it
- Decide one strategy: install JDKs with setup-java, or enable auto-download plus a resolver.
- Do not leave auto-download off while requesting an uninstalled toolchain.
- Keep the toolchain request aligned with what the runner provides.