Maven Deploy Error Code 405 Method Not Allowed
Contents |
here for a quick overview of the site Help Center Detailed answers to maven error deploying artifact failed to transfer file return code is 405 any questions you might have Meta Discuss the workings and nexus return code is 405 reasonphrase http method put is not supported by this url policies of this site About Us Learn more about Stack Overflow the company Business Learn artifactory "405: method not allowed" more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow maven failed to transfer file return code is 405 Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Trying to get Maven to deploy to Artifactory Server up vote 7 down vote favorite I'm trying to get a project to deploy to our Artifactory
Nexus 405
repository. The user qazwart is an administrator and has the permission to deploy to the server. I have that user's correct information in the settings.xml file under the
a file to your Maven repository, it's because the URL (as in -Durl=http://host.com/repo) you
Failed To Deploy Artifacts Could Not Transfer Artifact 400
have specified is somehow incorrect. For example, I was trying http method put is not supported by this url nexus to deploy a file using the mvn deploy:deploy-file target to a Nexus repository, and artifactory put 405 I got the following error: $ mvn deploy:deploy-file -DgroupId=com.austje.test -DartifactId=project -Dversion=1.0 -Dpackaging=jar -Dfile=project.jar -Durl=http://repo1.austje.com/ -DrepositoryId=MyReleases [INFO] Scanning for projects... [INFO] Searching repository for plugin with http://stackoverflow.com/questions/28591055/trying-to-get-maven-to-deploy-to-artifactory-server prefix: 'deploy'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [deploy:deploy-file] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] [deploy:deploy-file {execution: default-cli}] Uploading: http://repo1.austje.com//com/austje/test/project/1.0/project-1.0.jar [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error deploying artifact: Failed to transfer file: http://repo1.austje.com//com/austje/test/project/1.0/project-1.0.jar. Return code is: 405 [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven http://jessicaaustin.net/405-error-when-deploying-to-maven-repository/ with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO] Finished at: Mon Jan 25 11:15:25 CST 2010 [INFO] Final Memory: 5M/9M [INFO] ------------------------------------------------------------------------ Looking at the line Uploading: http://repo1.austje.com//com/austje/test/project/1.0/project-1.0.jar, it's pretty obvious that my url is wrong-that's not where the artifact should be uploaded at all. Turns out I gave the repository server, but not the actual repository url! Changing my url parameter to reflect this $ mvn deploy:deploy-file -DgroupId=com.austje.test -DartifactId=project -Dversion=1.0 -Dpackaging=jar -Dfile=workingTest.zip -Durl=http://repo1.austje.com/nexus/content/repositories/my-repo/ -DrepositoryId=MyReleases fixed the issue, and I was able to deploy successfully. Of course, this is not the only way you could screw up the url parameter. Among many possibilities, one tricky one I've seen is using http instead of https as the protocol. Extra tip: If you fix the URL and are now getting return code 401, your credentials are incorrect. Try fixing them in your settin
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 has received your deployment request but cannot process https://support.sonatype.com/hc/en-us/articles/213464668-Troubleshooting-Artifact-Deployment-Failures 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 release repositories, since redeploying release artifacts is a maven anti-pattern. failed to 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 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 return code is 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. Code 402 - Payment Required This error is returned if you are using Nexus 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 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. If you need help diagnosing this contact support. Code 503 - Service unavailable This is not thrown by Nexus but instead your reverse proxy. Is