Skip to content

Conversation

@nielspardon
Copy link
Member

I've been seeing build failures recently where Maven Central responds with a 403 while fetching dependencies. This could be due to some Github Actions workers causing excessive traffic for Maven Central and being blocked: https://central.sonatype.org/faq/403-error-central/

This PR enables Gradle caching on Github Actions to limit traffic to Maven Central: https://github.com/actions/setup-java?tab=readme-ov-file#caching-gradle-dependencies

Further since we are using the Gradle wrapper I don't think we need the setup-gradle Github Actions task so I'm removing it which should also speed up the builds a little.

Signed-off-by: Niels Pardon <par@zurich.ibm.com>
@bestbeforetoday
Copy link
Member

bestbeforetoday commented Jan 6, 2026

setup-gradle claims to have better caching than the gradle caching provided by setup-java. See docs. The GitHub docs on building Java with Gradle also suggest using setup-gradle.

@nielspardon
Copy link
Member Author

setup-gradle claims to have better caching than the gradle caching provided by setup-java. See docs. The GitHub docs on building Java with Gradle also suggest using setup-gradle.

they also seem to claim the caching is enabled by default. any idea why it does not seem to cache dependencies and fetches them on every run?

@bestbeforetoday
Copy link
Member

I notice in the post setup-gradle job in PR builds the message:

Cache is read-only: will not save state for use in subsequent builds

I believe the cache is only updated from jobs that run on the default (main) branch, and is then visible to other jobs. My guess is that, since we don't have an integration / merge build or regular scheduled build that runs directly on the main branch, the cache is never getting written. Or at least not getting written recently enough to be very helpful.

I'm not sure the setup-java cache will do any different. The post setup-java step in the build checks for this PR say:

Cache hit occurred on the primary key setup-java-Linux-x64-gradle-94f49267a0a6e332c4f0d1f9bedb464ff5bb7eeb1aeb33375503d2cfcd228c13, not saving cache.

@nielspardon
Copy link
Member Author

closing this for now. will try to understand the setup-gradle task better.

@nielspardon nielspardon closed this Jan 6, 2026
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