Codearte/gradle-nexus-staging-plugin

Execution failed for task ':closeRepository'.

softknife2021 opened this issue · 6 comments

Configure build.gradle and ran this command but has a failure below, what I am doing wrong?
./gradlew closeAndReleaseRepository

Configure project :

Task :closeRepository FAILED
GET request failed. 401: , body:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':closeRepository'.

401: , body:

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s
1 actionable task: 1 executed

szpak commented

Are you sure, you have the credentials configured properly? Have you tried to re-run it with --info? It should display something like:

"Using username 'xxx' and password from repository 'yyy'"

If no, you can - temporarily - put your username and password/key directly in the build.gradle to check if it helps (just locally, do NOT commit it to GitHub!).

image
yes it looks ok, have password and user set correctly. Not sure what I is wrong

szpak commented

You print some properties, but the closeRepository task doesn't print them on its own, so they might not be properly set in the plugin. Please paste the way how you configure gradle-nexus-staging-plugin, especially credentials.

szpak commented
plugins {
    ....
    id 'io.codearte.nexus-staging' version '0.30.0'
    ...
    id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
}

You mix two plugins doing (almost) the same. As mentioned in the README, io.github.gradle-nexus.publish-plugin is a successor of io.codearte.nexus-staging. In addition, you configure only the second plugin, but call tasks from the first one...

So, remove id 'io.codearte.nexus-staging' version '0.30.0' completely and try to call closeSonatypeStagingRepository (as suggested in the documentation - https://github.com/gradle-nexus/publish-plugin#behind-the-scenes .