I am getting 401 error while deploying in nexus. I does not make any changes to the installed nexus. Nexus is running on localhost:8080/nexus
and i am able to login with default user/password. When i am running mvn deploy
i am getting this error.
Here is my POM.
<groupId>testproject</groupId>
<artifactId>testproject</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>testproject</name>
<url>http://maven.apache.org</url>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8080/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8080/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
.........
</dependencies>
and ~/.m2/settings.xml
<servers>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
Exception:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default- deploy) on project testproject: Failed to deploy artifacts: Could not transfer artifact testproject:testproject:jar:1.0-20131213.150615-1 from/to snapshots (http://localhost:8080/nexus/content/repositories/snapshots): Failed to transfer file: http://localhost:8080/nexus/content/repositories/snapshots/testproject/testproject/1.0-SNAPSHOT/testproject-1.0-20131213.150615-1.jar.
Return code is: 401 -> [Help 1]
Please help me.
Nexus is a repository manager that stores “artifacts”, which allows you to proxy collect and manage your dependencies, making it easy to distribute your software.
The deploy plugin is primarily used during the deploy phase, to add your artifact(s) to a remote repository for sharing with other developers and projects. This is usually done in an integration or release environment.
It's working now. Need to edit ${MVN_HOME}/conf/settings.xml
instead of /home/{user}/.m2/settings.xml
HTTP 401 is the status code for "unauthorized", which implies that your deployment
user isn't authorized to upload artifacts to that particular repository in Nexus. Log in to Nexus and give the deployment
user the role(s) required to to change that snapshot repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With