Share

July 30, 2010

Maven/Nexus Failed to transfer file: Return code is: 401


If you ever get the following error

Caused by: org.apache.maven.wagon.TransferFailedException: Failed to transfer file:  http://nexus/content/repositories/snapshots/XXX Return code is: 401
        at org.apache.maven.wagon.providers.http.LightweightHttpWagon.finishPutTransfer(LightweightHttpWagon.java:205)
        at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:413)
        at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:392)
        at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:365)
        at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:163)
        at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:317)
        at org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(DefaultWagonManager.java:227)
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:107)

Do the following:

if you pom.xml looks like

    

  
   releases
   Release Repository
   http://nexus/content/repositories/releases/
  
  
   snapshots
   Snapshot Repository
   http://nexus/content/repositories/snapshots/
  

then make sure you setting.xml has matchign ids with passwords

  
     
       releases
       deployment
       deployment
     
     
       snapshots
       deployment
       deployment