Error when deploying an artifact in Nexus
Im' getting an error when deploying an artifact in my own repository in a Nexus server: "Failed to deploy artifacts: Could not transfer artifact" "Failed to transfer file http:///my_artifact. Return code is: 400"
I have Nexus running with one custom repository my_repo with the next maven local configuration:
settings.xml
<server>
<id>my_repo</id>
<username>user</username>
<password>pass</password>
</server>
...
<mirror>
<id>my_repo</id>
<name>Repo Mirror</name>
<url><my_url_to_my_repo></url>
<mirrorOf>*</mirrorOf>
</mirror>
- user has permissions to create/read/write into my_repo -
pom.xml
<distributionManagement>
<repository>
<id>my_repo</id>
<name>my_repo</name>
<url><my_url_to_my_repo></url>
<layout>default</layout>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url><my_url_to_my_snapshot_repo></url>
</snapshotRepository>
</distributionManagement>
and then I execute
mvn deploy
and get the error. Any idea?
Solution 1:
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.
Solution 2:
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
.
Solution 3:
400 Bad Request will be returned if you attempt to:
- Deploy a snapshot artifact (or version) ending in -SNAPSHOT to a release repository
- Deploy a release artifact (version not ending in -SNAPSHOT) to a snapshot repository
- Deploy the same version of a release artifact more than once to a release repository