2010-09-08

Maven Error: Return code is: 401 - TransferFailedException

Problem:

Uploading: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying artifact: Failed to transfer file: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar. Return code is: 401

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact: Failed to transfer file: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar. Return code is: 401
Caused by: org.apache.maven.plugin.MojoExecutionException: Error deploying artifact: Failed to transfer file: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar. Return code is: 401
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Error deploying artifact: Failed to transfer file: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar. Return code is: 401
Caused by: org.apache.maven.wagon.TransferFailedException: Failed to transfer file: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar. Return code is: 401
Solution:
Add

        <server>
            <id>loxal</id>
            <username>deployer</username>
            <password>password</password>
        </server>

to the section of your settings.xml in
  • The Maven install: $M2_HOME/conf/settings.xml (this worked for me)
  • A user's install: ${user.home}/.m2/settings.xml
 whereby loxal should be replaced by the repo id where you want to upload your artifacts.