CLOVIS
09/24/2023, 6:29 PMpublishAllPublicationsToCentralRepository
for a multiplatform project creates multiple staging repositories on Nexus?
The klib
of one of the modules is sent to its own staging repository. Even the sha1 etc files are sent to the other, so closing fails with "missing checksum validation".mbonnin
09/24/2023, 6:33 PMCLOVIS
09/24/2023, 6:34 PMmbonnin
09/24/2023, 6:35 PMephemient
09/24/2023, 6:38 PMCLOVIS
09/24/2023, 6:43 PMpublish to a temporary local repo first and then to do a bulk upload of that to sonatypeDo you have an example of how to do that?
If you publish from different machine, this is more likely to happen but I've seen this with single machines tooI wonder if it happens because I have the configuration cache enabled, and thus is does multiple uploads in parallel 🤔
mbonnin
09/24/2023, 6:43 PMCasey Brooks
09/24/2023, 6:48 PM./gradlew openSonatypeStagingRepository
./gradlew publish
./gradlew closeSonatypeStagingRepository
then manually release the builds from Nexus
CLOVIS
09/24/2023, 6:49 PMThe plugin must be applied to the root projectbut then all the examples use the
publishing
DSL to configure the POM etc, which definitely cannot be in the root project since it doesn't have any code/artifacts…Casey Brooks
09/24/2023, 6:50 PMmbonnin
09/24/2023, 6:52 PMDo you have an example of usage of gradle-nexus in a multi-project build?I don't sadly, I'm trying to handle the publishing with as little dependencies as possible. Every publishing plugin out there does some things slightly differently. But I wrote a small Kotlin client that opens/closes a staging repo so it's a few lines to do so https://github.com/martinbonnin/vespene
CLOVIS
09/24/2023, 6:53 PMmbonnin
09/24/2023, 6:53 PMCasey Brooks
09/24/2023, 6:54 PMCLOVIS
09/24/2023, 6:54 PMmbonnin
09/24/2023, 6:55 PMCLOVIS
09/24/2023, 6:56 PMCasey Brooks
09/24/2023, 7:00 PMbuild.gradle.kts
file as possible, so doesn’t have too many surprises in it.
It’s also not documented, but you can see how it’s used from my other libraries, like Ballast which is usually the one kept the most up-to-date with the convention pluginsCLOVIS
09/24/2023, 7:01 PMplugins { id("…") apply false }
is not transitive: if you add it in a convention plugin, and apply the convention plugin, it applies that plugin as well.mbonnin
09/24/2023, 7:20 PMCLOVIS
09/24/2023, 7:21 PMkotlin("multiplatform") apply false
in a convention plugin for the root project, and well, that doesn't workmbonnin
09/24/2023, 7:22 PMapply false
to pull the plugin jar in the buildscript classpathbuild-logic/build.gradle.kts#dependencies.implementation()
Jeff Lockhart
09/24/2023, 7:40 PMCLOVIS
09/24/2023, 8:32 PMmbonnin
09/24/2023, 8:38 PMromainbsl
09/25/2023, 7:13 AM<https://s01.oss.sonatype.org/service/local/staging/deployByRepositoryId/${repositoryId}/>
CLOVIS
09/25/2023, 8:28 AMmbonnin
09/25/2023, 8:29 AMdifferent Gradle invocations
, not different VMs. My hunch is that the initializeStagingRepo
task stores its state (the repoId
) on the local filesystemyou might want to publish from CI and close and release from your local machineAh, maybe not after all 🤔
Looks like it stores state on Sonatype (and therefore allows only one repo at a time?)./gradlew findSonatypeStagingRepository
the repository can be found later using the same description.Right so it's a bit better but still feels a bit backward
CLOVIS
09/25/2023, 8:38 AMLooks like it stores state on Sonatype (and therefore allows only one repo at a time?)What I've seen is that it adds the full name of the artifact, including version, as the description of the staging repo, and I assume it's supposed to use those to find it again later? But in my case, it doesn't seem like it does
Feels fragile because if you do 2 publish at the same time, you're doomedI guess it's unlikely to do two publishes for the same project and same version at the same time, so it should be safe
mbonnin
09/25/2023, 8:50 AMCLOVIS
09/25/2023, 8:51 AMmbonnin
09/25/2023, 8:53 AMfindStagingRepository
going to re-use a previous entry, what are the inputs of the tasksCLOVIS
09/25/2023, 9:06 AMmbonnin
09/25/2023, 9:15 AMCLOVIS
09/25/2023, 9:05 PM:findSonatypeStagingRepository
before executing the :closeSonatypeStagingRepository
, which will make it find it correctly. However, it doesn't seem to work for the :publishToSonatype
task, which still creates a new repository.
I created an issue → https://github.com/gradle-nexus/publish-plugin/issues/275Jeff Lockhart
09/25/2023, 10:58 PMIt also avoids issues like having multiple staging repositories on Sonatype OSS
andylamax
09/26/2023, 1:49 AMCLOVIS
09/27/2023, 8:32 PMJeff Lockhart
09/27/2023, 11:49 PM