将maven提交到中央仓库

本文涉及的产品
对象存储 OSS,20GB 3个月
对象存储 OSS,恶意文件检测 1000次 1年
对象存储 OSS,内容安全 1000次 1年
简介: 1. 先创建账号,地址为:https://issues.sonatype.org/secure/Signup!default.jspa2. 再创建一个工单(Issues),地址为:https://issues.

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/

相关实践学习
借助OSS搭建在线教育视频课程分享网站
本教程介绍如何基于云服务器ECS和对象存储OSS,搭建一个在线教育视频课程分享网站。
相关文章
|
5天前
|
JavaScript Java Maven
云效产品使用常见问题之android sdk 构建出aar后,上传到私有maven仓库失败如何解决
云效作为一款全面覆盖研发全生命周期管理的云端效能平台,致力于帮助企业实现高效协同、敏捷研发和持续交付。本合集收集整理了用户在使用云效过程中遇到的常见问题,问题涉及项目创建与管理、需求规划与迭代、代码托管与版本控制、自动化测试、持续集成与发布等方面。
|
2月前
|
Java Maven
java修改当前项目的maven仓库地址为国内
修改当前项目的maven仓库地址为国内
|
3月前
|
Java Maven 数据安全/隐私保护
弄懂maven仓库 & 仓库优先级 & settings & pom配置关系及差异
弄懂maven仓库 & 仓库优先级 & settings & pom配置关系及差异
506 1
|
4月前
|
Java Maven 数据安全/隐私保护
Nexus【应用 01】上传jar包到私有Maven仓库的两种方法:手动 Upload 和 mvn deploy 命令(配置+操作流程)
Nexus【应用 01】上传jar包到私有Maven仓库的两种方法:手动 Upload 和 mvn deploy 命令(配置+操作流程)
363 0
|
4月前
|
XML Java 大数据
答应粉丝的Maven仓库学习笔记,今天它来了 一起来学习快速入门Maven
答应粉丝的Maven仓库学习笔记,今天它来了 一起来学习快速入门Maven
78 1
|
4月前
|
Java Maven
请问一下云效maven仓库迁移怎么弄?
请问一下云效maven仓库迁移怎么弄?
60 0
|
4月前
|
域名解析 安全 Java
Maven向中央仓库提交自己的Jar包
Maven向中央仓库提交自己的Jar包
83 0
|
4月前
|
存储 Java Linux
Nexus【部署 01】CentOS 7.5 环境下搭建私有Maven仓库实录(启动问题处理+安装文件 nexus-3.4.0-02-unix.tar.gz 云盘链接)
Nexus【部署 01】CentOS 7.5 环境下搭建私有Maven仓库实录(启动问题处理+安装文件 nexus-3.4.0-02-unix.tar.gz 云盘链接)
104 0
|
4月前
|
前端开发 Java 应用服务中间件
Maven仓库安装
Maven仓库安装
52 0
|
4月前
|
Java Maven 数据安全/隐私保护
研发提效必备技能:手把手教你基于Docker搭建Maven私服仓库
在研发的过程中,很多企业都会针对自身业务特点来定制研发一些工具类库,但是这些工具类库又不会对外公开,那如何在组织内部共享这些类库呢?一种很好的方式就是在公司内部搭建一套Maven私服仓库。
77 0
 研发提效必备技能:手把手教你基于Docker搭建Maven私服仓库

热门文章

最新文章

推荐镜像

更多