Skip to content

chore: Download the JDKs that the build does not find - #124

Merged
kous500 merged 1 commit into
mainfrom
chore/jdk-auto-download-20261114
Nov 14, 2026
Merged

kous500 merged 1 commit into
mainfrom
chore/jdk-auto-download-20261114

Conversation

@kous500

@kous500 kous500 commented Nov 14, 2026

Copy link
Copy Markdown
Owner

What and why

Building the project needed JDK 25, which Gradle runs on, and JDK 21, which the jars for older Minecraft versions are compiled with, installed by hand. Gradle can download missing JDKs itself once it knows where from, so this adds a toolchain resolver.

  • settings.gradle: the foojay toolchain resolver (org.gradle.toolchains.foojay-resolver-convention 1.0.0). Gradle downloads a toolchain into ~/.gradle/jdks when no installed JDK matches. A comment says what it downloads and that Gradle itself needs Java 25 for Loom 1.18.
  • gradle/gradle-daemon-jvm.properties: written by ./gradlew updateDaemonJvm --jvm-version=25, with a download URL of Java 25 for each operating system and architecture (Eclipse Adoptium Temurin 25.0.5). The JDK for Gradle itself stays at that version until the task is run again.
  • README and CONTRIBUTING.md: a JDK is needed to start Gradle; JDK 25 and JDK 21 are used when installed and downloaded otherwise.

CI installs its JDKs with setup-java and passes them to Gradle, so it should not download any.

How it was tested

  • Without JAVA_HOME and with -Porg.gradle.java.installations.auto-detect=false, :curvebuilding-fabric:1.21.1:compileJava downloaded JDK 21 (Temurin 21.0.13) and compiled with it.
  • With only JDK 21 on the PATH, Gradle downloaded JDK 25 (Temurin 25.0.5) and ran on it.
  • ./gradlew build checkCodeStyle --warning-mode all: the build and unit tests pass, with no Gradle, javac or Checkstyle warnings.
  • Not checked: a build in CI with this change, and whether IntelliJ IDEA sets up the project SDK from it.
  • Minecraft version: -
  • Server software / loader: -
  • WorldEdit / FastAsyncWorldEdit version: -

Notes

  • No changes for players or server owners.

The foojay toolchain resolver lets Gradle download the JDKs it needs
when they are not installed: those that the jars are compiled with,
and Java 25 for Gradle itself, whose download URLs are written into
gradle/gradle-daemon-jvm.properties by updateDaemonJvm. The README and
CONTRIBUTING.md no longer ask to install JDK 25 and JDK 21.
@kous500
kous500 merged commit cfa474c into main Nov 14, 2026
28 checks passed
@kous500
kous500 deleted the chore/jdk-auto-download-20261114 branch November 14, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant