发布项目到中央库的一些常见问题

来源:互联网 发布:南平seo快速优化软件 编辑:程序博客网 时间:2024/06/05 06:27

1 无法 close and release

  • 问题描述:mvn clean deploy之后在Nexus staging repository(https://oss.sonatype.org/#welcome)中找不到项目,无法close和release

  • 原因:maven 插件 nexus-staging-maven-plugin 中的 autoReleaseAfterClose 属性设置为 true 了。所以 mvn release 时自动上传到 staging repository ,并且自动执行了 close->release->drop 三步曲。而 drop 之后就没有了。

    <plugin>    <groupId>org.sonatype.plugins</groupId>    <artifactId>nexus-staging-maven-plugin</artifactId>    <version>1.6.7</version>    <extensions>true</extensions>   <configuration>        <serverId>ossrh</serverId>        <nexusUrl>https://oss.sonatype.org/</nexusUrl>        <autoReleaseAfterClose>true</autoReleaseAfterClose>    </configuration></plugin>
  • 解决方法:这个根本不用解决。。。可以在sonatype公有库里查看到你的项目 https://oss.sonatype.org/content/groups/public/ 。过两个小时在中央库也可以查到了。

  • 如果想体验一把close和release,可以把 autoReleaseAfterClose 属性设置为false。这样在 mvn release之后会在 Nexus staging repository 里看见你刚传上来的,选中之后可以手动 close 并 release 了,release 时会显示自动 drop。

2 无法更新项目

  • 问题描述:当第一次部署完成后,更改了项目的代码,继续发布。会发现在 https://oss.sonatype.org/content/groups/public/ 中能看到更新了。但是中央库和maven库没有更新。

  • 原因:发布更新后的项目时候使用了相同的版本号。尽管sonatype允许重新发布一个已存在的版本,但是maven库和中央库是不允许的,这会使得下载了之前发布的那些项目因为你的改动而出问题。

官方回应:Sonatype policy prohibits to removal or any other modification of artifacts after they’ve been published to Central. If you wish to provide updated artifacts via Maven Central, you have to deploy a new version. Even though oss.sonatype.org allows for re-publishing over a existing version, those artifacts will NOT overwrite what’s on Maven Central, and that’s by design. Our policies exist because if you release artifacts and delete or change them after people have already started depending on them, any changes will cause existing builds to break.
So, in summary, if want to publish updated artifacts, please increment your version number and deploy them as new artifacts.

  • 解决方法:更新项目继续发布时,需要修改版本号。
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 家里pvc灯罩变黄怎么办 欧普吸顶灯灯罩坏了怎么办 硬盘用久了变慢怎么办 地税申报工资人员弄错怎么办 买保险保单丢了怎么办 买保险的银行卡丢了怎么办 没学过JAVA入职怎么办 磨砂皮擦了鞋油怎么办 磨破皮伤口有沙子怎么办 工行信用卡被风险锁定了怎么办 超重被超限站查住以后怎么办 银行卡输入密码次数超限怎么办 信用卡密码错误次数超限怎么办 农行密码错误次数超限怎么办 剪力墙偏心受拉怎么办 韵达快递寄丢了怎么办 重要快递送丢了怎么办 快递员送货丢了怎么办 买的快递丢失了怎么办 申通把件弄丢了怎么办 淘宝快递送丢了怎么办 我的快递丢了怎么办 顺丰快递丢件怎么办 韵达快递不发货怎么办 发物流丢了怎么办啊 圆通快递寄丢了怎么办 中通快递弄丢了怎么办 中通快递寄丢了怎么办 中通快递丢了怎么办 物流没保价坏了怎么办 顺丰保值快递丢了怎么办 顺丰保价件丢失怎么办 公司购买货物对方没有发票怎么办 加工货物对方不取怎么办 物流发货发错了怎么办 货车拉的货丢了怎么办 壹米滴答丢货怎么办 物流东西弄丢了怎么办 理赔款账号打错了怎么办 顺丰快递搞丢了怎么办 论文表格跨页了怎么办