Maven error: Not authorized, ReasonPhrase:Unauthorized

后端 未结 4 622
轻奢々
轻奢々 2021-01-01 08:42

I checked out my code from the Nexus repository repository. I changed the password for my account and set it correctly inside my settings.xml file. While execut

相关标签:
4条回答
  • 2021-01-01 08:56

    The problem here was a typo error in the password used, which was not easily identified due to the characters / letters used in the password.

    0 讨论(0)
  • 2021-01-01 09:01

    You have an old password in the settings.xml. It is trying to connect to the repositories, but is not able to, since the password is not updated. Once you update and re-run the command, you should be good.

    0 讨论(0)
  • 2021-01-01 09:08

    The issue may happen while fetching dependencies from a remote repository. In my case, the repository did not need any authentication and it has been resolved by removing the servers section in the settings.xml file:

    <servers>
        <server>
          <id>SomeRepo</id>
          <username>SomeUN</username>
          <password>SomePW</password>
        </server>
    </servers>
    

    ps: I guess your target is mvn clean install instead of maven install clean

    0 讨论(0)
  • 2021-01-01 09:10

    I have recently encountered this problem. Here are the steps to resolve

    1. Check the servers section in the settings.xml file.Is username and password correct?

    <servers>
      <server>
        <id>serverId</id>
        <username>username</username>
        <password>password</password>
      </server>
    </servers>

    1. Check the repository section in the pom.xml file.The id of the server tag should be the same as the id of the repository tag.

    <repositories>
    	<repository>
    	  <id>serverId</id>  
    	  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    	</repository>
    </repositories>

    1. If the repository tag is not configured in the pom.xml file, look in the settings.xml file.

    <profiles>
    	<profile>
    	  <repositories>
    	    <repository>
    		    <id>serverId</id>
    		    <name>aliyun</name>
    		    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    	    </repository>
    	  </repositories>
    	</profile>
    </profiles>

    Note that you should ensure that the id of the server tag should be the same as the id of the repository tag.

    0 讨论(0)
提交回复
热议问题