Repository navigation
Disable the configuration cache for publish tasks - #769
Conversation
cpovirk
left a comment
There was a problem hiding this comment.
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.
…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)
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. |
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-cachewhich 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.