Codearte / gradle-nexus-staging-plugin

Automatize releasing Gradle projects to Maven Central.
Apache License 2.0
172 stars 26 forks source link

Still encountering "stagingRepositoryId is not provided" #158

Closed io7m closed 3 years ago

io7m commented 4 years ago

Hello!

I'm trying to put together a simple testing project in an effort to give developers at the NYPL something they can use to run through the process of deploying to Maven Central (without needing to do a real deployment of a real app). The structure of the project matches that of the larger projects at the NYPL, but only contains a single module and very little code. Here's the project:

https://github.com/NYPL-Simplified/Maven-Central-Testing

I'm trying to bulletproof it, and part of that involves using the nexus-publish-plugin so that we know staging repository IDs explicitly instead of having the gradle-nexus-staging-plugin try to guess them. We have multiple developers pushing different projects to the same staging profile, and without having explicit staging repository IDs, the gradle-nexus-staging-plugin essentially breaks immediately (due to the documented and expected Wrong number of received repositories problem).

As far as I can make out, I've configured everything correctly in the project's build.gradle setup, and I'm applying both plugins so that, if the nexus-publish-plugin documentation can be believed, I should be using explicit staging repository IDs when I ./gradlew clean assemble publish closeAndReleaseRepository. Unfortunately, it appears that I'm not. I still see "DEPRECATION WARNING. The staging repository ID is not provided. The fallback mode may impact release reliability and is deprecated. Please consult the project FAQ how it can be fixed.".

What am I doing wrong? I've attached a log of a build that deployed and released on Central successfully, but I suspect that it would not have been successful had someone else been pushing something to the staging profile at the same time.

log.txt

szpak commented 4 years ago

Hello! I took a look at your build configuration and logs and it seems that nexus-publish-plugin (NPP) doesn't wrap your publish tasks with publishing to the implicitly created staging repository (and in fact doesn't create it at all). In that situation gradle-nexus-staging-plugin (GNSP) can only guess which repository should be closed (which seems to work as fallback).

@marcphilipp is it possible that Android uses some other kind of publishing (or it is configured in different way) which could not be detected by NPP?

io7m commented 4 years ago

'Ello.

This has actually become a bigger problem for us: The plugin appears to now be effectively unreliable enough in this configuration that we can almost never deploy to Central using it. I think this is probably interacting with the staging latency problems Central has been having lately.

RoRoche commented 4 years ago

I do have the same warning message:

> Task :closeRepository
DEPRECATION WARNING. The staging repository ID is not provided. The fallback mode may impact release reliability and is deprecated. Please consult the project FAQ how it can be fixed.
szpak commented 4 years ago

@RoRoche Have you consulted the project FAQ?

RoRoche commented 4 years ago

@RoRoche Have you consulted the project FAQ?

Yes, but I didn't find anything about this deprecation.

szpak commented 4 years ago

Please try this one. You might propose a PR with changes adding the 3rd point in FAQ with that exact warning message.

RoRoche commented 4 years ago

I followed steps described in your blog post: https://solidsoft.wordpress.com/2019/02/22/reliable-releasing-to-maven-central-from-travis-using-gradle-2019-edition/

My configuration is here: https://github.com/RoRoche/elegant-android/blob/master/build.gradle And here: https://github.com/RoRoche/elegant-android/blob/master/publish/publish_kotlin_library.gradle

But I'm still having:

DEPRECATION WARNING. The staging repository ID is not provided. The fallback mode may impact release reliability and is deprecated. Please consult the project FAQ how it can be fixed.
Requested operation was executed successfully in attempt 8 (maximum allowed 21)

Any idea of what I'm doing wrong?

szpak commented 4 years ago

Hmm,. I wonder if you don't need to apply plugin: "de.marcphilipp.nexus-publish" in the (sub)project you releasing. As opossed to my GNSP plugin which should be applied in the root project, NPP plays with the publications.

Btw, do you have a link to the CI server where the build takes place?

szpak commented 3 years ago

TL;TD. That problem should not exist in unified gradle-nexus-publish-plugin.

A longer version. To make releasing to Maven Central even easier, I and Marc Phillip (the author of nexus-publish-plugin) combined forces to create a next generation, unified, 2-in-1 plugin - gradle-nexus-publish-plugin. It is a recommended solution, as our development effort will be put in that new plugin. See my blog post and the official migration guide.