Why am I getting a “401 Unauthorized” error in Maven?

前端 未结 21 1836
栀梦
栀梦 2020-11-29 18:06

Why am I getting a \"401 Unauthorized\" error in Maven?

Here\'s the error I\'m getting when calling mvn deploy (full logs at the bottom):

21条回答
  •  醉酒成梦
    2020-11-29 18:23

    I was dealing with this running Artifactory version 5.8.4. The "Set Me Up" function would generate settings.xml as follows:

    
        
          ${security.getCurrentUsername()}
          ${security.getEscapedEncryptedPassword()!"AP56eMPz8L12T5u4J6rWdqWqyhQ"}
          central
        
        
          ${security.getCurrentUsername()}
          ${security.getEscapedEncryptedPassword()!"AP56eMPz8L12T5u4J6rWdqWqyhQ"}
          snapshots
        
    
    

    After using the mvn deploy -e -X switch, I noticed the credentials were not accurate. I removed the ${security.getCurrentUsername()} and replaced it with my username and removed ${security.getEscapedEncryptedPassword()!""} and just put my encrypted password which worked for me:

    
        
          username
          AP56eMPz8L12T5u4J6rWdqWqyhQ
          central
        
        
          username
          AP56eMPz8L12T5u4J6rWdqWqyhQ
          snapshots
        
    
    

    Hope this helps!

提交回复
热议问题