使用Maven Deploy项目到Nexus时报错:Return code is: 401, ReasonPhrase: Unauthorized

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Alexshi5/article/details/81633404

一、问题描述

今天在使用Maven命令:mvn deploy将项目部署到nexus中时报错如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project maibao-parent: Failed to deploy artifacts: Could not transfer artifact com.mengfei:maibao-parent:pom:1.0-20180813.090224-1 from/to central (http://192.168.188.132:8081/nexus/content/groups/public): Failed to transfer file: http://192.168.188.132:8081/nexus/content/groups/public/com/mengfei/maibao-parent/1.0-SNAPSHOT/maibao-parent-1.0-20180813.090224-1.pom. Return code is: 401, ReasonPhrase: Unauthorized.

二、问题原因

没有得到nexus的认证授权,即账号、密码不正确或者根本没有配置

三、解决问题

nexus的默认账号为:admin,默认密码为:admin123

如果没有配置的请在setting.xml文件的<servers></servers>中配置一个server,配置内容如下:

    <server>
      <id>snapshots</id><!--此处的id要与nexus中的仓库id和pom中配置的repository id保持一致-->
      <username>admin</username>
      <password>admin123</password>
    </server>

参考: https://blog.csdn.net/li396864285/article/details/73530321

猜你喜欢

转载自blog.csdn.net/Alexshi5/article/details/81633404