maven-deploy失败

昨天遇到的问题,mavne项目执行deploy的时候,出错。提示

Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

很直白,就是权限问题。

那就上网搜索,deploy的配置。其实要deploy到远端私服,就两点:

1:本地pom文件,配置

  <distributionManagement>
   <repository>
    <id>releases</id>
    <name>Internal Releases</name>
    <url>http://自己服务器地址:8081/nexus/content/repositories/releases</url>
   </repository>
  </distributionManagement>

2:maven的setting.xml配置

<servers>
     <server>
       <id>releases</id>   <!-- 注意这里的id名字要和pom.xml里配置的名字保持一致 -->
       <username>deployment</username>
       <password>deployment</password>
     </server>
</servers>



检查下来,两条都“符合”,我的天这肿么办。于是再看。。。

最终发现,项目顶层有parent配置,parent配置中distributionManagement项的id是另一个名字。

so找不到对应server配置的用户名、密码。

但是再想想,我项目的pom.xml里已经配置了,为什么没有抵掉parent里的配置呢。

猜你喜欢

转载自rd-030.iteye.com/blog/2358045
今日推荐