Maven – Error when deploying an artifact in Nexus

deploymentmavennexuspom.xml

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?

Best Answer

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.

Related Topic