Codearte / gradle-nexus-staging-plugin

Automatize releasing Gradle projects to Maven Central.
Apache License 2.0
172 stars 26 forks source link

Multiple staging profiles created on upload by Gradle in Travis causes closeRepository task to fail #76

Closed pavolloffay closed 5 years ago

pavolloffay commented 5 years ago

Hi,

we are having issues to use this plugin when VM (travis) changes public IP during the release.

From https://help.sonatype.com/repomanager2/staging-releases/managing-staging-repositories

A separate staging repository is created for every combination of User ID, IP Address, and User Agent

This jira https://issues.sonatype.org/browse/OSSRH-19485?focusedCommentId=340094&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-340094 advices to use profile id.

We have added stagingProfileId to our gradle config however the build still fails e.g. https://travis-ci.org/jaegertracing/jaeger-client-java/jobs/441639782#L775 and it still creates multiple staging repositories: screenshot of nexus repository manager

Here is out gradle config https://github.com/jaegertracing/jaeger-client-java/blob/master/build.gradle#L87 and also https://github.com/jaegertracing/jaeger-client-java/blob/master/gradle/publish.gradle.

Any help is appreciated.

szpak commented 5 years ago

It's a big problem, I'm also not able to automatically release my project using Travis. In fact, it happens in the upload phase (multiple staging repositories are created) and closeRepository only visualize a problem. It affects also one-thread execution, even for a single module projects. I don't know how it could be solved at the gradle-nexus-staging-plugin level (merging staging repositories via API is not an option :) ).

Unfortunately Travis is unlikely to fix it on their side. There is an open issue for Gradle. You can comment there, as it seems to be a good place to fix it (it would be possible for gradle-nexus-staging-plugin to track one particular staging repository not to check number of them in a given state).

Update. I changed the title to more accurate.

szpak commented 5 years ago

For desperate hearts, there is a workaround available by @jakubhava.

szpak commented 5 years ago

It works fine with nexus-publish-plugin.

I updated the project FAQ to address it. A copy-paste for people hitting that issue.

To cut a long story short:

For releasing from Travis (and in general) it's recommended to add nexus-publish-plugin to your project and use its publishToNexus task to upload/publish artifacts to Nexus (instead of vanilla publish... from Gradle). It integrates seamlessly with gradle-nexus-staging-plugin to release to Maven Central (especially with 0.20.0+) - no other changes are required. What's more, with that enhancement implemented the releasing to Nexus will be even more reliable (e.g. an ability to run multiple releases for the same staging profile).

However, there is one caveat. uploadArchives from the maven plugin is not supported by nexus-publish-plugin (only publish... from maven-publish).