How to avoid multiple staging repositories when pu...
# gradle
t
How to avoid multiple staging repositories when publishing a project to Maven Central? I tried
org.gradle.parallel=false
but it seems to have no effect. The project has quite a few artifacts.
a
do you have configuration cache enabled?
org.gradle.parallel
controls whether subprojects can run in parallel, while configuration cache allows any task to run in parallel. But
--no-parallel
doesn't disable configuration cache parallisation. It's confusing :( https://github.com/gradle/gradle/issues/24253
So, try with
--no-configuration-cache
. And if that doesn't work, for a quick fix, limit the max-workers to 1
Copy code
./gradlew publish -Dorg.gradle.workers.max=1
(documented here)
thank you color 1
v
Neither of that will work afair. This is a quite known problem, especially if you publish from some infrastructure with multiple outgoing IP addresses like CircleCI or similar. You should use this plugin which among other things fixes this problem: https://github.com/gradle-nexus/publish-plugin
thank you color 1
☝️ 1
2
t
Now I've just published the sub-projects one-by-one. I'll check the suggestions at the next publish. Thank you.
👌 1
v
An alternative would be to switch to the new central publisher portal infrastructure, which afaik should not have this problem anymore.
t
Will that work with multiplatform?
v
I have no idea, never worked with that new infrastructure. But as it is the only option for new publishers, I'd hope so.
m
Will that work with multiplatform?
Yep. Only downsides right now are: • no stats • no SNAPSHOTs
As an alternative to @Vampire suggestion, I also recommend https://vanniktech.github.io/gradle-maven-publish-plugin/. It’s also setting up publications for you. In the KMP case, KGP does it automagically but if you ever publish a JVM-only or Android project, it’s handy
2