I am getting a “401 Content access is protected by token” authentication failure while performing maven release. But I did not make any changes regarding Sonatype/Nexus.
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy (injected-nexus-deploy) on project manifold-all: Remote staging failed: Failed to deploy artifacts: Could not transfer artifact systems.manifold:manifold-tuple-rt:jar.asc:javadoc:2024.1.19 from/to ossrh (https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/systemsmanifold-1279): authentication failed for https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/systemsmanifold-1279/systems/manifold/manifold-tuple-rt/2024.1.19/manifold-tuple-rt-2024.1.19-javadoc.jar.asc, status: 401 Content access is protected by token
This is my own FOSS repo and I’m not doing anything special. I released the prior version a few days ago with no problems. And reading this it appears this “protected by token” feature can only be set in Sonatype Nexus Repository software, which I do not have or use.
Not sure how this could happen without my making changes via Sonatype/Nexus. Any ideas?
Sonatype won’t help me because I’m not a paying customer. Thanks.
Change the pulldown from “Summary” to “User Token”
Click on “Access User Token”
I am using Gradle in my project, so I have all my credentials stored in a private gradle.properties file. Using the username and password values from the “Access User Token” popup, I created two new entries:
ossrhToken=...
ossrhTokenPassword=...
And finally, I updated my Gradle build script, shoud look something like this:
maven {
credentials {
username = findProperty("ossrhToken") as String
password = findProperty("ossrhTokenPassword") as String
}
}
I have an existing project that publishes to oss.sonatype.org. I’ve accessed my token, stored it in my private gradle.properties, and replaced my old username / password configuration with:
maven {
name = "nexus"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = findProperty("ossrhToken") as String
password = findProperty("ossrhTokenPassword") as String
}
}
but I still get Received status code 401 from server: Content access is protected by token. I don’t understand what I’m missing.
Do I need to start publishing via s01.oss.sonatype.org? I don’t have account credentials there and my understanding was existing projects keep using the original server.
I’m experiencing the same problem. The token has been created, the settings.xml file has been updated, but I’m getting “401 - Unauthorized” reply from the server. What’s my next step?