jar包发布到中央仓库

发布到中央

 

OSSRH 使用说明

访问存储库

以下存储库允许您直接访问 OSSRH 中的组件。用户只需通过中央存储库直接获取您的组件,但对于项目中的提交者和其他合作者,此列表可能很有用。

注意:自 2021 年 2 月起,所有新项目都开始在Nexus Repository Manager上进行配置 。如果您的项目未在https://s01.oss.sonatype.org/ 上配置,您将需要使用旧主机Nexus Repository Manager

一:注册 Sonatype JIRA 账户:

Sonatype JIRA网站:https://issues.sonatype.org
注册页面:https://issues.sonatype.org/secure/Signup!default.jspa
登录页面:https://issues.sonatype.org/login.jsp

  1. 注册:

     
  2. 注册成功显示:

     
  3. 注册成功你会收到一封邮件:

     
  4. 首次登录设置语言:
    也可在个人资料中设置:https://issues.sonatype.org/secure/ViewProfile.jspa

     
  5. 设置头像:

二:创建仓库

  1. 点击创建问题:
    也可以在导航栏点击新建按钮:

     
  2. 项目填写:

     
  3. 创建完成后如图所示:

     
  4. 创建完成你会收到一封邮件:
    可能立即给你发送,也可能需要一点时间。

三:验证域名所有权

  1. 创建完成后这时你会收到一封邮件:

     

  2. 解析域名:

  3. 解析后如图所示:

     

  4. 刷新项目页面,点击 Respond

     

  5. 等待验证域名需要一到两天,域名验证成功后,会收到邮件:



     

  6. 查看所有项目:

 四:安装Gpg4win

  1. 官网:https://www.gpg4win.org/
    下载页面:https://www.gpg4win.org/get-gpg4win.html

     

  2. 点击 Download 后,即可下载(下载速度较慢,推荐使用迅雷)。
     

  3. 安装:

  4. 语言切换:

     

  5. 创建密钥:
    点击新建秘钥对
    输入名字电子邮件
    名字:不支持数字开头。
    名字和邮箱输入完成后,点击下一步

  6. 点击新建

     

  7. 输入密码(Passphrase)和确认密码(Repeat):
    输入完成,点击OK:

  8. 完成创建显示:
    点击完成即可。

     

  9. 可在软件中查看密钥对信息:

     

五:打包上传

  1. 创建项目参见:Maven 打包(.jar、-sources.jar、-javadoc.jar)

    注意:项目版本不能带有 -SNAPSHOT
     
  2. Maven settings.xml 配置:
        <server>
          <id>sonatype-nexus-snapshots</id>
          <username>sonatype 用户名</username>
          <password>sonatype 密码</password>
        </server>
    	
        <server>
          <id>sonatype-nexus-staging</id>
          <username>sonatype 用户名</username>
          <password>sonatype 密码</password>
        </server>


     
  3. 打包上传:
    Microsoft Windows [版本 10.0.18362.207]
    (c) 2019 Microsoft Corporation。保留所有权利。
    
    D:\demo>mvn clean deploy -P sonatype-oss-release
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ---------------------< cn.com.xuxiaowei.json:json >---------------------
    [INFO] Building json 1.0
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ json ---
    [INFO] Deleting D:\demo\target
    [INFO]
    [INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-maven) @ json ---
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ json ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ json ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 2 source files to D:\demo\target\classes
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ json ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory D:\demo\src\test\resources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ json ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ json ---
    [INFO] No tests to run.
    [INFO]
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ json ---
    [INFO] Building jar: D:\demo\target\json-1.0.jar
    [INFO]
    [INFO] --- maven-source-plugin:2.1.2:jar-no-fork (attach-sources) @ json ---
    [INFO] Building jar: D:\demo\target\json-1.0-sources.jar
    [INFO]
    [INFO] --- maven-javadoc-plugin:2.7:jar (attach-javadocs) @ json ---
    [INFO]
    正在加载程序包cn.com.xuxiaowei.test.entity的源文件...
    正在加载程序包cn.com.xuxiaowei.test的源文件...
    正在构造 Javadoc 信息...
    标准 Doclet 版本 1.8.0_211
    正在构建所有程序包和类的树...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\entity\Person.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\JSONUtils.html...
    正在生成D:\demo\target\apidocs\overview-frame.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\package-frame.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\package-summary.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\package-tree.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\entity\package-frame.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\entity\package-summary.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\entity\package-tree.html...
    正在生成D:\demo\target\apidocs\constant-values.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\entity\class-use\Person.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\class-use\JSONUtils.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\package-use.html...
    正在生成D:\demo\target\apidocs\cn\com\xuxiaowei\test\entity\package-use.html...
    正在构建所有程序包和类的索引...
    正在生成D:\demo\target\apidocs\overview-tree.html...
    正在生成D:\demo\target\apidocs\index-all.html...
    正在生成D:\demo\target\apidocs\deprecated-list.html...
    正在构建所有类的索引...
    正在生成D:\demo\target\apidocs\allclasses-frame.html...
    正在生成D:\demo\target\apidocs\allclasses-noframe.html...
    正在生成D:\demo\target\apidocs\index.html...
    正在生成D:\demo\target\apidocs\overview-summary.html...
    正在生成D:\demo\target\apidocs\help-doc.html...
    [INFO] Building jar: D:\demo\target\json-1.0-javadoc.jar
    [INFO]
    [INFO] --- maven-gpg-plugin:1.1:sign (sign-artifacts) @ json ---
    GPG Passphrase: 输入 Gpg4win 密码
    
    上面输入 Gpg4win 密码后,可能会出现弹窗,再次输入 Gpg4win 密码


     
    GPG Passphrase: 
    gpg: WARNING: "--no-use-agent" is an obsolete option - it has no effect
    gpg: WARNING: "--no-use-agent" is an obsolete option - it has no effect
    gpg: WARNING: "--no-use-agent" is an obsolete option - it has no effect
    gpg: WARNING: "--no-use-agent" is an obsolete option - it has no effect
    [INFO]
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ json ---
    [INFO] Installing D:\demo\target\json-1.0.jar to D:\Program Files\apache-maven-3.6.1\repo\cn\com\xuxiaowei\json\json\1.0\json-1.0.jar
    [INFO] Installing D:\demo\pom.xml to D:\Program Files\apache-maven-3.6.1\repo\cn\com\xuxiaowei\json\json\1.0\json-1.0.pom
    [INFO] Installing D:\demo\target\json-1.0-sources.jar to D:\Program Files\apache-maven-3.6.1\repo\cn\com\xuxiaowei\json\json\1.0\json-1.0-sources.jar
    [INFO] Installing D:\demo\target\json-1.0-javadoc.jar to D:\Program Files\apache-maven-3.6.1\repo\cn\com\xuxiaowei\json\json\1.0\json-1.0-javadoc.jar
    [INFO] Installing D:\demo\target\json-1.0.jar.asc to D:\Program Files\apache-maven-3.6.1\repo\cn\com\xuxiaowei\json\json\1.0\json-1.0.jar.asc
    [INFO] Installing D:\demo\target\json-1.0.pom.asc to D:\Program Files\apache-maven-3.6.1\repo\cn\com\xuxiaowei\json\json\1.0\json-1.0.pom.asc
    [INFO] Installing D:\demo\target\json-1.0-sources.jar.asc to D:\Program Files\apache-maven-3.6.1\repo\cn\com\xuxiaowei\json\json\1.0\json-1.0-sources.jar.asc
    [INFO] Installing D:\demo\target\json-1.0-javadoc.jar.asc to D:\Program Files\apache-maven-3.6.1\repo\cn\com\xuxiaowei\json\json\1.0\json-1.0-javadoc.jar.asc
    [INFO]
    [INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ json ---
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0.jar
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0.jar (3.5 kB at 704 B/s)
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0.pom
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0.pom (1.4 kB at 418 B/s)
    Downloading from sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/maven-metadata.xml
    Downloaded from sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/maven-metadata.xml (301 B at 398 B/s)
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/maven-metadata.xml
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/maven-metadata.xml (301 B at 113 B/s)
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0-sources.jar
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0-sources.jar (2.6 kB at 1.1 kB/s)
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0-javadoc.jar
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0-javadoc.jar (38 kB at 13 kB/s)
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0.jar.asc
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0.jar.asc (499 B at 620 B/s)
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0.pom.asc
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0.pom.asc (499 B at 350 B/s)
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0-sources.jar.asc
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0-sources.jar.asc (499 B at 647 B/s)
    Uploading to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0-javadoc.jar.asc
    Uploaded to sonatype-nexus-staging: https://oss.sonatype.org/service/local/staging/deploy/maven2/cn/com/xuxiaowei/json/json/1.0/json-1.0-javadoc.jar.asc (499 B at 702 B/s)
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  01:36 min
    [INFO] Finished at: 2019-07-03T12:36:40+08:00
    [INFO] ------------------------------------------------------------------------
    
    D:\demo>
    
  4. 查看已上传的jar包:
    网址:https://oss.sonatype.org
    输入账户密码。

     
  5. 查看已上传的jar包及加密信息:
  6. 在本地目录中查看:

     
  7. 双击 .asc 文件查看签名:

     
  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值