maven deploy报错:Return code is: 401, ReasonPhrase: Unauthorized. ->

2022-10-25 15:11:08 浏览数 (1)

Return code is: 401, ReasonPhrase: Unauthorized. ->

解决方法:

  1. 在maven的settings.xml 文件中 添加
代码语言:javascript复制
<servers>
	<server>
      <id>releases</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
    <server>
      <id>snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>
  1. 项目的pom文件添加:
代码语言:javascript复制
<distributionManagement>
        <repository>
            <id>releases</id>
            <url>http://nexus.local.com/content/repositories/thirdparty</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <url>http://nexus.local.com/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

注意 pom文件的id 要和在 maven中配置的server的id 一致 否则不起作用

然后就deploy成功了

参考博客: https://blog.csdn.net/a15835774652/article/details/80354602

0 人点赞