Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when deploying an artifact in Nexus

People also ask

Could not transfer artifact from to Nexus releases?

This is authorization issue. Open settings. xml file from folder where maven is installed and correct the user ID and password. It should solve your problem.

Could not transfer artifact return code is 400?

Code 400 - Method not Allowed 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.

How we can upload artifacts into Nexus repository manager?

Go to "http://localhost:8081/nexus" Login as user: "admin" password: "admin123" Click on "Browse Repositories," and you'll see a list of repositories. You will want to right click on the "3rd Party" repository and choose "Upload Artifact."


A couple things I can think of:

  • user credentials are wrong
  • url to server is wrong
  • user does not have access to the deployment repository
  • user does not have access to the specific repository target
  • artifact is already deployed with that version if it is a release (not -SNAPSHOT version)
  • the repository is not suitable for deployment of the respective artifact (e.g. release repo for snapshot version, proxy repo or group instead of a hosted repository)

Check those and if you still run into trouble provide more details here.


Just to create a separate answer. The answer is actually found in a comment for the accepted answer.

Try changing the version of your artefact to end with -SNAPSHOT.


400 Bad Request will be returned if you attempt to:

  1. Deploy a snapshot artifact (or version) ending in -SNAPSHOT to a release repository
  2. Deploy a release artifact (version not ending in -SNAPSHOT) to a snapshot repository
  3. Deploy the same version of a release artifact more than once to a release repository

Cause of problem for me was -source.jars was getting uploaded twice (with maven-source-plugin) as mentioned as one of the cause in accepted answer. Redirecting to answer that I referred: Maven release plugin fails : source artifacts getting deployed twice


I had this exact problem today and the problem was that the version I was trying to release:perform was already in the Nexus repo.

In my case this was likely due to a network disconnect during an earlier invocation of release:perform. Even though I lost my connection, it appears the release succeeded.


In the rare event that you need to redeploy the SAME STABLE artifact to Nexus, it will fail by default. If you then delete the artifact from Nexus (via the web interface) for the purpose of deploying it again, the deploy will still fail, since just removing the e.g. jar or pom does not clear other files still laying around in the directory. You need to log onto the box and delete the directory in its entirety.


I had the same problem today with the addition "Return code is: 400, ReasonPhrase: Bad Request." which turned out to be the "artifact is already deployed with that version if it is a release" problem from answer above enter link description here

One solution not mentioned yet is to configure Nexus to allow redeployment into a Release repository. Maybe not a best practice, because this is set for a reason, you nevertheless could go to "Access Settings" in your Nexus repositories´ "Configuration"-Tab and set the "Deployment Policy" to "Allow Redeploy".