将maven提交到中央仓库

1. 先创建账号,地址为:<wbr style="user-select: text !important; line-height: 28px;">

https://issues.sonatype.org/secure/Signup!default.jspa

2. 再创建一个工单(Issues),地址为:

https://issues.sonatype.org/secure/CreateIssue.jspa?issuetype=21&pid=10134

1,2步 参考: http://www.cnblogs.com/gaoxing/p/4359795.html

以下地址有关于工单的详细介绍:

http://blog.csdn.net/xiaowangdalai/article/details/46743683

3. 创建完成后主要是等待管理员回复.

通常会先问你配置的包名对应的域名是否属于你自己.

[图片上传中...(image-a200a0-1512122804585-7)]

我这里简单回复“Yes”.表示域名是我自己的。

参见: https://my.oschina.net/looly/blog/270767

第二次发布,我直接使用域名对应的邮箱注册的账号,所以没有问这个问题.

接着等待管理员回复:

com.icexls has been prepared, now user(s) icexls can:

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">如果回复这一段话表明你可以上传代码了。</font>

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">4. 需要先下载一个签名工具,下载地址为:</font>

https://www.gpg4win.org/download.html

签名中一些参数选择直接使用默认的即可,即 直接按回车键。

如果看到下图表明你生成签名成功了。

[图片上传中...(image-1a1083-1512122804587-8)]

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">生成签名可以参考:</font>

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">http://blog.csdn.net/hj7jay/article/details/51130398</font>

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">5. 修改setting文件,</font>

包含

<font face="Courier New" style="user-select: text !important; line-height: 28px;">server标签和</font>

profile标签,这里我只配置了

server标签。

profile标签主要是配置

<font face="Courier New" style="user-select: text !important; line-height: 28px;">passphrase密码,即生成密钥时输入的密码。这里不配置</font>

profile标签到时候会弹出对话框让你手动输入密码。

参见:

<font face="Courier New" style="user-select: text !important; line-height: 28px;">http://www.cnblogs.com/gaoxing/p/4359795.html</font>

6. 运行执行命令:

<font face="monospace" style="user-select: text !important; line-height: 28px;">mvn clean deploy -P release。</font>

<font face="monospace" style="user-select: text !important; line-height: 28px;">由于这里是在eclipse里运行的,所以省略 mvn,变为

clean deploy -P release。</font>

<font face="monospace" style="user-select: text !important; line-height: 28px;">注意eclipse jdk版本配置正确,有时eclipse会默认配置为1.5.需要手动改过来。</font>

<font face="monospace" style="user-select: text !important; line-height: 28px;">注意eclipse配置的jdk路径指向jdk而不是jre.</font>

<font face="monospace" style="user-select: text !important; line-height: 28px;">参见: https://my.oschina.net/looly/blog/270767</font>

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">7. 主要是修改pom文件,使他符合要求求:</font>

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">参见: https://my.oschina.net/looly/blog/270767</font>

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">此时我这边报错:</font>

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">[INFO] Final Memory: 17M/184M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project icexls: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

找了半天,最后发现是 distributionManagement标签位置不对(或者说是因为执行maven命令未加-p参数,致使配置的预处理未起作用,但表面上看

distributionManagement却实配置了

)。

正要上传时却发现配置的中央仓库路径连不上。

但是中央仓库路径确实是可以访问的,最后发现是因为 snapshotRepository 和repository配置反了,因为这段配置是网上copy的,他这边写的和我的标签位置相反。

改过来后仍然连不上,郁闷!

原来网上copy的地址是连的他内部的局域网,赶紧改过来。

8.上传成功后需要做的主要是改变代码状态。

需要打开网站:

https://oss.sonatype.org/

此时又发现网站打不开。有找了半天,原来是org改成了com(原因还是 网址是copy的,copy的地方写错了).

改过来后却发现 打开该网址太慢。我这里等了半小时。(怀疑与上网时间有关系,建议晚上20:00以后打开)

参见: http://blog.csdn.net/xiaowangdalai/article/details/46743683

9. 网站打开后需要先使用你的issue账号登陆。然后

找到左边的Staging Repositories。再在右边填入你的项目名称 搜索对应记录,先点击close.过一会刷新,如果没报错,再点

release.

很不幸,这里又报错了:

[图片上传中...(image-314d72-1512122804583-6)]</font> <font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">原因是 使用了

clean deploy而不是

clean deploy -P release。这个命令与你的pom.xml文件对应。

如果正确应该是:

[图片上传中...(image-f6e399-1512122804583-5)]</font> 还有一次也出现类似问题:

执行clean deploy -P release命令总是失败,

失败信息如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (sign-artifacts) on project icenongli: Unable to execute gpg command: Error while executing process. Cannot run program "gpg.exe": CreateProcess error=2, ?????μ??? -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

经过实验,分析可能的原因是公钥服务器不稳定。

可能是 由于公钥服务器不稳定,导致上传时验签失败。

也可能 生成公钥时已经失败了,只是没有发现。如图:

[图片上传中...(image-1b6057-1512122804583-4)]

然后我试着ping服务器ip,发现无法连接。

[图片上传中...(image-c514cb-1512122804583-3)]

然后查找了一些其他服务器,试了下,如图:

[图片上传中...(image-f64512-1512122804583-2)]

最后点击close,验签终于通过了,如图:

[图片上传中...(image-45e30e-1512122804583-1)]

<font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">参见: http://blog.csdn.net/xiaowangdalai/article/details/46743683

10. 这时可以通知 Issue,我这里回复 Hi,release done!

[图片上传中...(image-cd903f-1512122804583-0)]</font>   <font face="Tahoma, Arial" style="user-select: text !important; line-height: 28px;">11\. 刚开始我的项目只在中央仓库显示,http://mvnrepository.com/并没有,不过过几天(大约3天)就有了,可能同步需要一段时间吧。</font>

http://blog.163.com/sxgyyyxh@126/blog/static/16161493120173993814454/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值