Hi all. I'm having trouble trying to publish my li...
# library-development
x
Hi all. I'm having trouble trying to publish my library to sonatype. Somehow the maven publish task is generating duplicate repositories when it finishes execution. As a result, the desktop artefact get separated from everything else, and prevents closing these repositories due to
Copy code
Missing: no main jar artifact found in folder '/io/github/xxfast/kstore-desktop/0.8.0'
You can find my github action job here, and my scripts for my library here. Does anyone have any clue as to what is wrong? 🤔
1
m
i call these "split staging replsitories": Sonatype uses heuristics to determine what belongs together. Things like IP address and upload time I guess. The problem with KMP is that it may take some time to upload and Sonatype will create 2 staging repositories.
The solution is to create the staging repo explicitely. https://github.com/vanniktech/gradle-maven-publish-plugin is doing it for you as well as many other things
x
Hi Martin - thanks for the reply. Is there any kmp sample code i can look at - from either plugin - to create this staging repo explicitly?
m
It’s doing it under the hood automatically
When you do this
Copy code
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
it’ll create the staging repo automatically
👀 1
(it can also close and release automatically)
If you’re looking for alternatives, https://github.com/gradle-nexus/publish-plugin/ can also help
x
ok so I ended up splitting my publishing tasks per each module via a github build matrix - and that somehow tricked sonatype to group these artefacts correctly in the correct split staging repository With this approach I was able to close and release the repositories - will see if this actually works https://github.com/xxfast/KStore/commit/f6ea7927b2f31b1e0d5bfc9fae5c57f32c45ffc2
👍 1
Thanks @mbonnin
m
Sure thing! If you want to publish from different machines, you can also take a look at https://github.com/nexus-actions/nexus-actions-demo
👀 1
But I like publishing everything from the same machine myself and the new maven central portal publishing flow requires that anyways