My question is stupidly simple: how do you log in to Nexus Repository Manager at https://oss.sonatype.org/?
Longer explanation:
I’m trying to debug why ./gradlew publish
fails with the a 401 error:
Execution failed for task ':initializeSonatypeStagingRepository'.
> Failed to load staging profiles, server at https://oss.sonatype.org/service/local/ responded with status code 401, body:
I have the following in my build.gradle.kts
plugins {
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id("maven-publish")
id("signing")
}
nexusPublishing {
repositories {
sonatype {
val baseUrl = "https://oss.sonatype.org"
nexusUrl.set(URI("$baseUrl/service/local/"))
snapshotRepositoryUrl.set(URI("$baseUrl/content/repositories/snapshots/"))
username.set(System.getenv("SONATYPE_USER"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}
I figured the very first thing I should do is manually make sure my SONATYPE_USER
and SONATYPE_PASSWORD
actually work, so I head on over to https://oss.sonatype.org/ and click log in.
When I created a Sonatype account at https://central.sonatype.com/api/auth/login, I created it through GitHub. Alas, on https://oss.sonatype.org/ there is no option to sign in via GitHub, so I try using the user token I generated at https://central.sonatype.com/account, but it is rejected.
There’s no option to create an account or reset a forgotten password, and when you fail to log in, the error message tells you to log in again before making further requests (?!).
Surprisingly, I couldn’t find anything in their documentation explaining how to do this. And of course before coming here to StackOverflow, I tried contacting their support, but my ticket was immediately closed because I’m not a paying customer.
So, how exactly are you supposed to log in?