Skip to content

Disable the configuration cache for publish tasks - #769

Merged
wmdietl merged 1 commit into
mainfrom
no-cache-publish
Sep 25, 2025
Merged

wmdietl merged 1 commit into
mainfrom
no-cache-publish

Conversation

@wmdietl

@wmdietl wmdietl commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator

After merging #755 CI failed when trying to publish artifacts, which is not tested in the PR CI.

I looked around a bit and it looks like the Nexus plugin is incompatible with the configuration cache. So, this PR selectively disables the configuration cache.

Tested with ORG_GRADLE_PROJECT_sonatypeUsername="abc" ORG_GRADLE_PROJECT_sonatypePassword="def" ./gradlew publishConformanceTestsPublicationToSonatypeRepository --no-configuration-cache which now fails because of invalid credentials, not because of configuration cache issues.

A previous issue/PR mentioned alternative "publish" plugins. Maybe somebody more familiar with those could rewrite this part.

@cpovirk cpovirk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I see gradle-nexus/publish-plugin#221.

As I understand things, the configuration cache is just a performance feature (as you'd hope from the word "cache" :)), so this seems like a good way to go. I could see disabling the cache entirely just to make our lives potentially simpler for a non-snapshot release in the future. But this PR addresses the immediate problem, and the plugin may well be fixed before we attempt a non-snapshot release. As an additional line of defense, I'll link this issue from our release "instructions" in #305.

@wmdietl
wmdietl merged commit ca76a8e into main Sep 25, 2025
@wmdietl
wmdietl deleted the no-cache-publish branch September 25, 2025 01:12
cpovirk added a commit that referenced this pull request Jul 9, 2026
…e. (#812)

As I understand it:

Under the current approach, if we run even `JAVA_VERSION=26 ./gradlew clean javadoc`, Gradle can reuse results from any previous run of `./gradlew clean javadoc`, even one with a different `JAVA_VERSION`.

By using [`providers.environmentVariable`](https://docs.gradle.org/current/kotlin-dsl/gradle/org.gradle.api.provider/-provider-factory/environment-variable.html) instead of directly accessing `System.env`, we tell Gradle that `JAVA_VERSION` is part of the inputs—and thus that it can't reuse outputs from a run with a different value.

This solves a problem I saw when I accidentally built Javadoc with the default `JAVA_VERSION` (11) and then tried to rebuild with a newer version, only to see no changes.

(previously in the Gradle configuration cache: #769)
@cpovirk

cpovirk commented Jul 30, 2026 •

Copy link
Copy Markdown
Collaborator

I could see disabling the cache entirely just to make our lives potentially simpler

Heh: #812, #836

The good news is that, between that first fix and #860, we should be able to remove this flag. I've created #862, which will fail CI until we've merged that fix and some other changes to our GitHub Actions configuration.

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