从本地提交到nexus时候报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project *: Failed to deploy artifacts: Could not transfer artifact *:jar:1.0 from/to releases (http://***.***.***.***:8081/nexus/content/repositories/releases/): Failed to transfer file: http://***.***.***.***:8081/nexus/content/repositories/releases/com/***/***-server* /1.0/*-1.0.jar. Return code is: 401, ReasonPhrase:Unauthorized.
原来是没有配置认证。
maven目录conf的setting.xml里,
- <servers>
- <server>
- <id>releases</id>
- <username>用户名</username>
- <password>密码</password>
- </server>
- <server>
- <id>snapshots</id>
- <username>用户名</username>
- <password>密码</password>
- </server>
- </servers>
在servers里面加入自己构建的私有库的账号密码(授权)
这样就可以解决401问题