vanniktech / gradle-maven-publish-plugin

A Gradle plugin that publishes your Android and Kotlin libraries, including sources and javadoc, to Maven Central or any other Nexus instance.
https://vanniktech.github.io/gradle-maven-publish-plugin
Apache License 2.0
1.28k stars 119 forks source link

Configuration cache problems #259

Open eygraber opened 3 years ago

eygraber commented 3 years ago

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.

gabrielittner commented 3 years ago

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 commented 1 year ago

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:

gabrielittner commented 1 year ago

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

MV-GH commented 11 months ago

KT-49933 has been fixed