Nexus deploy时遇到RELEASE does not allow metadata的排查路程

背景:

由于换了一家新单位,java工程上很多工具都没有部署,于是自己准备部署了一套nexus版本较新(伏笔)尝试从部署到使用一条路探雷然后给同事做培训。

按照正常的套路部署完以后配置maven setting文件;

核心配置

<servers>
<server>
<id>Robam_dkb_Release</id>
<username>admin</username>
<password>xxxx</password>
</server>
<server>
<id>Robam_dkb_SnapShort</id>
<username>admin</username>
<password>xxxx</password>
</server>
</servers>

<profiles>
<profile>
<id>nexusProfile</id>
<repositories>
<repository>
<id>central</id>
<url>http://xxxxx/repository/Robam_dkb_group/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexusProfile</activeProfile>
</activeProfiles>

pom文件配置

<distributionManagement>
<repository>
<id>Robam_dkb_Release</id>
<name>Robam_dkb_Release</name>
<url>http://xxxxx/repository/Robam_dkb_Release/</url>
</repository>
<snapshotRepository>
<id>Robam_dkb_SnapShort</id>
<name>Robam_dkb_SnapShort</name>
<url>http://xxxxx/repository/Robam_dkb_SnapShort/</url>
    </snapshotRepository>
</distributionManagement>



老公司的地址是http://xxxxx/nexus/content/groups/public/ 这样的地址 版本是老的

新版本的地址是http://xxxxx/repository/Robam_dkb_SnapShort 一开始是担心地址的问题

进入正题

maven deploy后出现

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project component: Failed to retrieve remote metadata com.robam.cloud.component:component:0.0.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.robam.cloud.component:component:0.0.1-SNAPSHOT/maven-metadata.xml from/to Robam_dkb_SnapShort (http://xxxx/repository/Robam_dkb_SnapShort2/): Transfer failed for http://xxxxx/repository/Robam_dkb_SnapShort2/com/robam/cloud/component/component/0.0.1-SNAPSHOT/maven-metadata.xml 400 Repository version policy: RELEASE does not allow metadata in path: com/robam/cloud/component/component/0.0.1-SNAPSHOT/maven-metadata.xml

因为新版本的index地址其实是http://xxxxx/service/rest/repository/browse/Robam_dkb_SnapShort/所以我尝试替换地址试试,然后deploy出现了405 Method Not Allowed 直接405了更不对了

然后仔细再看报错发现0.0.1-SNAPSHOT版本这么会提示RELEASE does not allow metadata呢哪里的对应关系搞错了?

后来百度各种属性修改依然不行,配置文件检查N遍还是没发现问题。后来发现仓库新建的时候有个的属性,坑爹,预发布仓库选成了稳定仓库。最后删除重建完成。

总结:其实这个问题回过头冷静下来想想就该知道,deploy发布既然有预发布和稳定的区别,创建仓库的时候就应该注意,属性的编辑。归根究底还是对maven的管理掌握的不够透彻。以前是衣来伸手饭来张口使用即可,别人都已经给你把路打平,现在必须要深入一点了解才行。

 

 

 


posted @ 2020-09-24 11:35  大背头  阅读(1255)  评论(0编辑  收藏  举报