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 executing mvn install clean
I get the error saying Not authorized, ReasonPhrase:Unauthorized
when it tries to download files from that repository.
Any idea how to solve this error? I am using Windows 7 with Maven 3.04
This question is related to
java
maven
repository
maven-3
nexus
I have recently encountered this problem. Here are the steps to resolve
<servers>_x000D_
<server>_x000D_
<id>serverId</id>_x000D_
<username>username</username>_x000D_
<password>password</password>_x000D_
</server>_x000D_
</servers>
_x000D_
<repositories>_x000D_
<repository>_x000D_
<id>serverId</id> _x000D_
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>_x000D_
</repository>_x000D_
</repositories>
_x000D_
<profiles>_x000D_
<profile>_x000D_
<repositories>_x000D_
<repository>_x000D_
<id>serverId</id>_x000D_
<name>aliyun</name>_x000D_
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>_x000D_
</repository>_x000D_
</repositories>_x000D_
</profile>_x000D_
</profiles>
_x000D_
Note that you should ensure that the id of the server tag should be the same as the id of the repository tag.
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.
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
Source: Stackoverflow.com