Solving multiple staging repositories being built when publishing to Nexus

Hi, I have a project consisting of multiple sub-projects that I publish to the Sonatype OSS repository via Nexus using the Maven publish plugin. Usually I build in parallel, but when I do this when publishing, multiple staging repositories are created. This seems to be a common problem when using Gradle to publish to nexus.

There seem to be two possible solutions:
A) provide a profile ID when publishing.
B) Run the publish task with “–no-parallel”.

In Maven, A) is done by providing <stagingProfileId>. How can this be done in Gradle?
If A) does not work in Gradle, is there a way to tell Gradle to run only the “publish” task with “–no-parallel”, preferably defined somewhere in build.gradle or build.properties.

Thanks,
Axel

That’s one of the main benefits when using GitHub - gradle-nexus/publish-plugin: Gradle plugin for publishing to Nexus repositories :wink:

1 Like