Visit my.sonatype.com for documentation on Nexus Repository version 2.
If an artifact fails to deploy from Maven (or other build tools), make note of the HTTP status code returned. Then check below to see what the code means, and how to diagnose and fix the issue.
Code 400 - Method not Allowed
Nexus Repository 2 has received your deployment request but cannot process it because it is invalid. There are two common causes for this.
The most common reason is that you are trying to re-deploy an artifact into a repository which does not allow redeployment. Check the "deployment policy" in your hosted repository configuration. If it is set to "disable redeploy" it means you cannot redeploy an artifact which is already in the repository. Note that this is the default setting for Nexus Repository release repositories, since redeploying release artifacts is a maven anti-pattern.
The second common reason for this code is that you are trying to deploy a release artifact into a snapshot repository, or vice versa.
Code 401 - Unauthorized
Either no login credentials were sent with the request, or login credentials which are invalid were sent. Checking the "authorization and authentication" system feed in the Nexus Repository UI can help narrow this down. If credentials were sent there will be an entry in the feed.
If no credentials were sent this is likely due to a mis-match between the id in your pom's distributionManagement section and your settings.xml's server section that holds the login credentials.
Tip: For a Maven deploy, you will likely see a failure message like this:
Caused by: org.eclipse.aether.transfer.
ArtifactTransferException: Could not transfer artifact com.foo.bar:fubar:jar:1.2.3 from/to nexus (http://localhost:8081/repository/releases):
The string following "from/to" is the ID of the "server" section Maven is expecting to see in the settings.xml file:
This error is returned if you are using Nexus Repository 2 Professional and your license has expired.
Code 403 - Forbidden
The login credentials sent were valid, but the user does not have permission to upload to the repository. Go to "administration/security" in the Nexus Repository UI, and bring up the user (or the user's role if they are mapped via an external role mapping) and examine the role tree to see what repository privileges they have been assigned. A user will need create and update privileges for a repository to be able to deploy into it.
Code 404 - Not Found
The repository URL is invalid. Note that this code is returned after the artifact upload has completed, so it can be a bit confusing.
Code 502 - Reverse Proxy Timeout
You have a reverse proxy in front of Nexus (such as Nginx or Apache+mod_proxy) and the pending deployment request had no activity for the period of time specified in the reverse proxy's timeout setting. This could be due to the timeout being set to a very low value, the Nexus server being under very high load, or a bug in Nexus Repository. If you need help diagnosing this contact support.
Code 503 - Service unavailable
This is not thrown by Nexus Repository, but instead your reverse proxy.
- Check that Nexus Repository is running.
- Nexus Repository is not redirecting correctly due to its force base url or jetty.xml settings. Review what has changed to make this stop working.
- Another server has the same IP as the Nexus Repository host and your reverse proxy is confused. This is a network issue that your IT staff may need to help you solve.
If it is none of these, then contact Sonatype support with your log files.
Code 5xx - Other Errrors
An exception was thrown in Nexus. Check you Nexus logs for an explanation. File an issue with Sonatype support, and supply your build log and the sonatype-work/nexus/logs/nexus.log file so that we can help diagnose the problem.