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:

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 last year, 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

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

Currently we are not able to support this kind of usernames. You will need to create a new user with a different username that contains only common ASCII characters from here: Create new JIRA account.

If you still are getting a 401 HTTP error and none of the above solutions work for you, please create a ticket using this link.