gradle-maven-publish-plugin icon indicating copy to clipboard operation
gradle-maven-publish-plugin copied to clipboard

Configuration cache problems

Open eygraber opened this issue 4 years ago • 5 comments

Looks like there are some issues with using this plugin when the configuration cache is enabled. Not sure if any of this is internal to Gradle or part of the plugin, but figured I'd record it here.

Here's a build of mine that failed because of it.

eygraber avatar May 21 '21 03:05 eygraber

I'll add support for it once the underlying Maven Publish and Signing plugins support configuration caching on the Gradle side https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:plugins

gabrielittner avatar May 21 '21 06:05 gabrielittner

maven-publish itself supports cc since 7.6 and the signing plugin will in Gradle 8.1. However there is one big open blocker when publishing to maven central https://github.com/gradle/gradle/issues/22779. When configuration cache is enabled the repository url will be evaluated eagerly and not when the publishing tasks are executed. Since we are computing that url based on the output of the task that creates the staging repo the build will fail with this:

Configuration cache state could not be cached: field `repository` of `org.gradle.api.publish.maven.tasks.PublishToMavenRepository$PublishSpec` bean found in field `value` of `org.gradle.internal.Try$Success` bean found in field `result` of `org.gradle.internal.serialization.Cached$Fixed` bean found in field `spec` of task `:nexus:publishMavenPublicationToMavenCentralRepository` of type `org.gradle.api.publish.maven.tasks.PublishToMavenRepository`: error writing value of type 'org.gradle.api.publish.maven.tasks.PublishToMavenRepository$RepositorySpec$Configured'
> Cannot query the value of this provider because it has no value available.
  The value of this provider is derived from:
    - task ':nexus:createStagingRepository' property 'stagingRepositoryId'

So current status:

  • Gradle 7.6: publishing to local or non maven central remote repositories works with cc when signing is disabled
  • Gradle 8.1: publishing to local or non maven central remote repositories works with cc with signing enabled
  • TBD: publishing to maven central works with cc

gabrielittner avatar Dec 30 '22 15:12 gabrielittner

With Gradle 8.1 being out the updated status is that config cache is supported in all scenarios except for:

  • Publishing releases to Maven Central (snapshots are fine), blocked by Gradle issue #22779.
  • Kotlin Multiplatform projects, blocked by KT-49933.

gabrielittner avatar Apr 15 '23 15:04 gabrielittner

KT-49933 has been fixed

MV-GH avatar Nov 13 '23 19:11 MV-GH