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
     
  

3 comments:

  1. It wonderfully worked for me. Thanks!
    Euler Oliveira.

    ReplyDelete
  2. Thanks you very much usefull post, it works!!! (2012/04/12)

    using a properly configured pom.xml, settings.xml and the command line mvn deploy it works.

    ReplyDelete
  3. awesome ...
    simple issue, but not so simple to track down.
    Thanks a Ton.
    In my case, the id in project pom had Typo ... :-)

    ReplyDelete