Skip to content

401 Unauthorized error⚓︎


You are receiving one of the following errors trying to publish an artifact to Central Repository:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-project:
Failed to deploy artifacts: Could not transfer artifact
com.mydomain:myproject:jar:1.0 from/to ossrh ( authentication failed
for, status:
401 Unauthorized -> [Help 1]
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy (injected-nexus-deploy)
on project my-project: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy failed:
Nexus connection problem to URL [ ]:
401 - Unauthorized -> [Help 1]

How can I fix it and be able to publish to the Central Repository?


There are multiple reasons why you are getting this error, please evaluate each of them below:

Signed up on

If you signed up to publish via, you should follow the publishing documentation for Maven, Gradle, uploading manually, or via the Publisher API. As the system is very new, there are a lot of third-party, community resources that direct people to publish via plugins that are compatible with OSSRH, which is a source of potential confusion.

Wrong credentials (username/password) in your setup

This is the most common reason for this error, a typo in your password or maybe the usage of a user without the publishing permissions could be the reason of the error. Confirm the right credentials and that the user has the required permissions. A common test is to login to the web console of the NXRM server ( or depending on where your project was registered) and use the credentials, you should not have problems logging into it if the credentials are right.

Password may contain unsupported characters (localized characters, symbols, non-ASCII)

Update your password as described in the documentation and set a new one without special characters. You could also generate an authentication token and use it to publish to the Central Repository.

You are trying to publish using the wrong NXRM server

Since 2021, new projects are being hosted in the new server If you are using an old documentation that may still be referring to the old NXRM server Please update your pom.xml and configuration files with the new server

If you still are getting a 401 HTTP error and none of the above solutions work for you, please contact Central Support.