Search code examples
mavenkotlingradlekotlin-multiplatform

Gradle maven-publish / Sonatype creates multiple repositories that can't be closed


I'm trying to deploy a library to Maven Central (which I have done many times before) but in this case it contains many different publications for different platforms. The upload by the maven-publish plugin works but I end up with multiple repositories in Sonatype with each repository containing a subset of the files:

enter image description here

As a result, I cannot close the repositories because some files are always missing (only all repositories together contain all files needed to pass Sonatype's validation).

The Sonatype documentation says:

A separate staging repository is created for every combination of User ID, IP Address, and User Agent. (https://help.sonatype.com/repomanager2/staging-releases/managing-staging-repositories)

All three parameters are identical for the created repositories though so it should create a single one. This happens when publishing locally and also when publishing from a Github action.

The repo is here: https://github.com/1gravity/Kotlin-Bloc

This is the publish script: https://github.com/1gravity/Kotlin-Bloc/blob/master/buildSrc/src/main/kotlin/bloc-publish.gradle.kts

Any help is highly appreciated!


Solution

  • In your gradle.properties, you have org.gradle.parallel=true.

    I had the same issue and resolved it by setting it to false for publishing.

    You can do so on the command line by publishing with

    ./gradlew publish -Dorg.gradle.parallel=false

    Apparently, sonatype does not play well with gradle parallel builds.