gradle-maven-publish-plugin: `closeAndReleaseRepository` fails because `publish` creates multiple staging repositories

I have a CI task that runs ./gradlew publish && ./gradlew closeAndReleaseRepository.

This usually works, but I just ran into a CI error:

More than 1 matching staging repository found in account ***. You can can explicitly choose one by passing it as an option like this "./gradlew closeAndReleaseRepository --repository comexample-123". Available repositories are: com***-1119, com***-1120

I confirmed that there were two staging repositories created, and they were both created by the publish task.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 25 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Just as an update, I’ve started working on explicitly creating a staging repository in the plugin that we can publish to explicitly.

Got the auto release working in one of my repos. Looks great, thanks!

the task was only creating a new repo if it didn’t find an already existing one

That part is there so that each build only creates one staging repo. In a multi project build where all projects apply the publish plugin each of them has a create task. We use the build service to share the result of whichever of the create tasks runs first with the others and use Gradle to make sure that the create tasks don’t run in parallel. So the first one will actually create it, the others will just retrieve the id from the build service, but all of this is scoped to a single build

OK I’ll try that now. I keep getting bitten by the SonatypeHost.S01 thing with a bunch of issues 🙈

I’ll open an issue for dropping staging repos on failure.