Skip to content

Run the Gradle daemon on any JDK 21 and download it from Adoptium - #2234

Merged
mpretty-cyro merged 3 commits into
session-foundation:devfrom
mpretty-cyro:fix/daemon-jvm-without-foojay
Oct 7, 2026
Merged

mpretty-cyro merged 3 commits into
session-foundation:devfrom
mpretty-cyro:fix/daemon-jvm-without-foojay

Conversation

@mpretty-cyro

@mpretty-cyro mpretty-cyro commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Every Android CI run currently fails before Gradle starts:

Unable to download toolchain matching the requirements ({languageVersion=21, vendor=JetBrains, implementation=vendor-specific, nativeImageCapable=false}) from 'https://api.foojay.io/disco/v3.0/ids/ecd23fd7707c683afbcd6052998cb6a9/redirect'

gradle/gradle-daemon-jvm.properties pins the Gradle daemon JVM to JetBrains 21 and downloads it through api.foojay.io package-id redirects. foojay stopped serving some of those ids (foojayio/discoapi#165, which reports the same JetBrains 21 ids returning 400). CI installs Temurin 21 with setup-java, but that doesn't meet a JetBrains criterion, so Gradle tries the foojay download and fails.

This drops the vendor, so any JDK 21 can run the daemon: CI's Temurin 21 is used as is with nothing to download, and locally Android Studio's JBR 21 still is. For a machine with no JDK 21, the Linux, macOS and Windows URLs now point straight at the Temurin 21.0.12.1+1 release assets that Adoptium (the Eclipse Foundation project that builds Temurin) publishes in adoptium/temurin21-binaries, instead of going through foojay, which only indexes vendors' downloads. They're pinned to that release rather than Adoptium's latest endpoint, so a provisioned daemon JDK only changes when this file does. FreeBSD and Unix get the Linux builds, as Adoptium has no builds for them; that matches the generated foojay entries, which used the Linux package ids for those platforms (and those ids return 400 now too). The vendor pin came in with #1923 with no stated reason; if it was wanted, say and I'll restore it with JetBrains' own download URLs instead.

The jvmToolchain(21) used for compilation has no vendor and the foojay resolver plugin stays; with a JDK 21 installed it never downloads.

These settings live on the updateDaemonJvm task in build.gradle.kts (JDK version, no vendor, the pinned URLs), so gradle-daemon-jvm.properties stays plain generated output: running ./gradlew updateDaemonJvm reproduces it exactly, and moving to a newer JDK is a change to that task.

Tested: all six pinned release URLs resolve (200). ./gradlew help with a fresh daemon starts on the local JDK 21 with the edited file. The local machine only has JetBrains' JDK 21, so this PR's own CI run is what shows a non-JetBrains JDK 21 being accepted.

The daemon JVM was pinned to JetBrains 21, fetched through api.foojay.io package-id redirects. foojay
stopped serving those ids (foojayio/discoapi#165), and CI's setup-java Temurin 21 doesn't meet a
JetBrains criterion, so every CI build failed provisioning the daemon before it started.

Drop the vendor so any JDK 21 runs the daemon: CI's Temurin 21 is used as is, and locally Android
Studio's JBR 21 still is. For machines with no JDK 21, the Linux/macOS/Windows URLs now go straight
to Adoptium's API instead of through foojay; FreeBSD/Unix keep foojay, as Adoptium has no builds for
them. Re-running updateDaemonJvm overwrites the file.
@mpretty-cyro
mpretty-cyro marked this pull request as ready for review October 7, 2026 22:47
The api.adoptium.net 'latest' URLs would hand a different JDK to a fresh machine whenever Adoptium
publishes a 21.x update. Point each platform at the 21.0.12.1+1 release asset instead, so a
provisioned daemon JDK only changes when this file does.
Comment thread gradle/gradle-daemon-jvm.properties Outdated
The previous commits edited gradle-daemon-jvm.properties by hand, so running updateDaemonJvm (to move
to a newer JDK, say) would have put the JetBrains vendor and foojay URLs back. Set languageVersion
and the Temurin download URLs on the updateDaemonJvm task instead, leaving the vendor unset; the
properties file is again plain generated output, and regenerating it reproduces it exactly.

Adoptium has no FreeBSD or other Unix builds, so those platforms get the Linux ones. That matches
what the generated foojay entries did (FREE_BSD/UNIX shared the Linux package ids), and those ids now
return 400 as well.
@mpretty-cyro
mpretty-cyro merged commit ae24eda into session-foundation:dev Oct 7, 2026
7 of 9 checks passed
@mpretty-cyro
mpretty-cyro deleted the fix/daemon-jvm-without-foojay branch October 7, 2026 23: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.

2 participants