如何发布jar包到maven中央仓库(2024年6月最新版含如何对原Jira系统内数据进行迁移)

本文主要是介绍如何发布jar包到maven中央仓库(2024年6月最新版含如何对原Jira系统内数据进行迁移),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.准备工作

1.1 进入系统注册账号

https://central.sonatype.com/

点击右上角 Sign-in登录

如果是首次登陆,需要点击Sign-Up注册账号

2.命名空间管理

2.1 注册Namespaces

点击右上角自己的账号->选中View Namespaces

进入命名空间列表后,点击Add Namespace,然后输入自己的命名空间名称

注:此处的命名空间名称对应的是自己项目里的GroupId

如果命名空间是之前JIRA系统存在,则参考第4章请求官方协助数据迁移。

2.2 校验Namespaces

按照提示完成域名身份校验

To prove the ownership of this Namespace, a DNS TXT Record is required with the same value that matches its Verification Key(ticket-123).For the Namespace org.spring.io you will need to create TXT Record:

ticket-123

Domain Registrars services have different procedures for adding a TXT Record, please check your registers documentation to find out how to add a TXT Record.

注意:此处添加TXT记录时,主机记录为:@,记录值为:ticket-123

添加成功后,打开如下地址验证域名baidu.com*(改成你自己的域名)*

https://www.whatsmydns.net/dns-lookup/txt-records?query=baidu.com&server=google

如果DNS记录可以查到,说明配置成功,就可以完成校验

TXT records for baidu.com:

RecordTypeValueTTL
baidu.comTXT“ticket-123”499

3.Maven发布

3.1 启用Token用户

选择 View Account,然后点击Generate User Token,即可生成maven发布专用用户。

3.2 GPG证书申请

参考文章

3.3 Maven pom 添加配置 (以Github Action方式正常运行)

<profiles><profile><id>release</id><build><plugins><plugin><groupId>org.sonatype.central</groupId><artifactId>central-publishing-maven-plugin</artifactId><version>0.5.0</version><extensions>true</extensions><configuration><publishingServerId>central</publishingServerId><autoPublish>true</autoPublish></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>3.3.0</version><executions><execution><id>attach-sources</id><phase>verify</phase><goals><goal>jar-no-fork</goal></goals></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-javadoc-plugin</artifactId><version>3.6.3</version><executions><execution><id>attach-javadoc</id><goals><goal>jar</goal></goals></execution></executions><configuration><stylesheet>java</stylesheet><doclint>none</doclint></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-gpg-plugin</artifactId><version>3.1.0</version><executions><execution><id>sign-artifacts</id><phase>verify</phase><goals><goal>sign</goal></goals></execution></executions><configuration><gpgArguments><arg>--pinentry-mode</arg><arg>loopback</arg></gpgArguments></configuration></plugin></plugins></build></profile></profiles><build><plugins><plugin><groupId>org.sonatype.central</groupId><artifactId>central-publishing-maven-plugin</artifactId><version>0.5.0</version><extensions>true</extensions><configuration><publishingServerId>central</publishingServerId><autoPublish>true</autoPublish></configuration></plugin></plugins></build>

3.4 Github Action脚本

name: Publish package to the Maven Central Repository
on:release:types: [created]
jobs:publish:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v4- name: Set up Maven Central Repositoryuses: actions/setup-java@v4with:java-version: '8'distribution: 'temurin'server-id: centralserver-username: MAVEN_USERNAMEserver-password: MAVEN_PASSWORDgpg-private-key: ${{ secrets.GPG_SECRET }}gpg-passphrase: MAVEN_GPG_PASSPHRASE- name: Publish packagerun: mvn -P release --batch-mode deploy -DskipTestsenv:MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}

Github Action secrets 如何使用请自行度娘。

4.JIAR 数据迁移

4.1 使用邮箱注册账号

如果你还记得JIRA注册时使用的邮箱,可以使用该邮箱联系central-support@sonatype.com

如果不记得JIRA注册时使用的邮箱,则需要使用已经注册的新账号绑定的邮箱联系官方通过DNS方式验证身份后,官方会协助迁移通过DNS验证的域名。

4.2 协助沟通邮件记录(新邮箱)

确认自己身份,请求协助

I’M authorized publisher. , but my old email : xxx can’t login.

I have login in new system by username & password ,

can provide other ways to check authorized publisher. ,eg: doamin add txt record

you can provide String code , I Add txt record to config.

获得官方回复

Hello,

Can you do the following:

  • Create a user for xxx on https://central.sonatype.com/
  • add the Domain TXT record ticket-12345 to com.baidu

此处com.baidu就是之前JIRA系统申请GroupId时使用的域名,新系统只需要注册一次即可,不用每个GroupId单独申请

Regards,
The Central Team

接下来我们只需要按照2.2章节配置DNS,然后给官方发送邮件

hello ,Try again

I have correctly configured the domain name Txt record for :baidu.com

https://www.whatsmydns.net/dns-lookup/txt-records?query=baidu.com&server=google

接下来我们就等候官方回复邮件

Hello ,

Apologies for the confusion, we are up to date on the thread.

We migrated your namespace as requested:

  • your user account on s01.oss.sonatype.org can no longer be used to create deployments for the com.baidu namespace
  • your account on central.sonatype.com associated with 你的新邮箱 has been updated to include the com.baidu namespace

Please login to Central Portal and confirm you see com.baidu as verified under your list of namespaces. After this you could follow the publishing instructions in our documentation to publish your components.

If you have any other question please feel free open a new request.

Thank you,
The Central Team

看到这个邮件后,我们就可以使用新账号登录新系统,然后看到对应的namespace官方已经帮我们

迁移到新账号下面了。

这篇关于如何发布jar包到maven中央仓库(2024年6月最新版含如何对原Jira系统内数据进行迁移)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1079007

相关文章

javaScript在表单提交时获取表单数据的示例代码

《javaScript在表单提交时获取表单数据的示例代码》本文介绍了五种在JavaScript中获取表单数据的方法:使用FormData对象、手动提取表单数据、使用querySelector获取单个字... 方法 1:使用 FormData 对象FormData 是一个方便的内置对象,用于获取表单中的键值

CSS3 最强二维布局系统之Grid 网格布局

《CSS3最强二维布局系统之Grid网格布局》CS3的Grid网格布局是目前最强的二维布局系统,可以同时对列和行进行处理,将网页划分成一个个网格,可以任意组合不同的网格,做出各种各样的布局,本文介... 深入学习 css3 目前最强大的布局系统 Grid 网格布局Grid 网格布局的基本认识Grid 网

Linux使用cut进行文本提取的操作方法

《Linux使用cut进行文本提取的操作方法》Linux中的cut命令是一个命令行实用程序,用于从文件或标准输入中提取文本行的部分,本文给大家介绍了Linux使用cut进行文本提取的操作方法,文中有详... 目录简介基础语法常用选项范围选择示例用法-f:字段选择-d:分隔符-c:字符选择-b:字节选择--c

Rust中的BoxT之堆上的数据与递归类型详解

《Rust中的BoxT之堆上的数据与递归类型详解》本文介绍了Rust中的BoxT类型,包括其在堆与栈之间的内存分配,性能优势,以及如何利用BoxT来实现递归类型和处理大小未知类型,通过BoxT,Rus... 目录1. Box<T> 的基础知识1.1 堆与栈的分工1.2 性能优势2.1 递归类型的问题2.2

Python使用Pandas对比两列数据取最大值的五种方法

《Python使用Pandas对比两列数据取最大值的五种方法》本文主要介绍使用Pandas对比两列数据取最大值的五种方法,包括使用max方法、apply方法结合lambda函数、函数、clip方法、w... 目录引言一、使用max方法二、使用apply方法结合lambda函数三、使用np.maximum函数

Python调用Orator ORM进行数据库操作

《Python调用OratorORM进行数据库操作》OratorORM是一个功能丰富且灵活的PythonORM库,旨在简化数据库操作,它支持多种数据库并提供了简洁且直观的API,下面我们就... 目录Orator ORM 主要特点安装使用示例总结Orator ORM 是一个功能丰富且灵活的 python O

Nginx设置连接超时并进行测试的方法步骤

《Nginx设置连接超时并进行测试的方法步骤》在高并发场景下,如果客户端与服务器的连接长时间未响应,会占用大量的系统资源,影响其他正常请求的处理效率,为了解决这个问题,可以通过设置Nginx的连接... 目录设置连接超时目的操作步骤测试连接超时测试方法:总结:设置连接超时目的设置客户端与服务器之间的连接

Java覆盖第三方jar包中的某一个类的实现方法

《Java覆盖第三方jar包中的某一个类的实现方法》在我们日常的开发中,经常需要使用第三方的jar包,有时候我们会发现第三方的jar包中的某一个类有问题,或者我们需要定制化修改其中的逻辑,那么应该如何... 目录一、需求描述二、示例描述三、操作步骤四、验证结果五、实现原理一、需求描述需求描述如下:需要在

定价129元!支持双频 Wi-Fi 5的华为AX1路由器发布

《定价129元!支持双频Wi-Fi5的华为AX1路由器发布》华为上周推出了其最新的入门级Wi-Fi5路由器——华为路由AX1,建议零售价129元,这款路由器配置如何?详细请看下文介... 华为 Wi-Fi 5 路由 AX1 已正式开售,新品支持双频 1200 兆、配有四个千兆网口、提供可视化智能诊断功能,建

使用 sql-research-assistant进行 SQL 数据库研究的实战指南(代码实现演示)

《使用sql-research-assistant进行SQL数据库研究的实战指南(代码实现演示)》本文介绍了sql-research-assistant工具,该工具基于LangChain框架,集... 目录技术背景介绍核心原理解析代码实现演示安装和配置项目集成LangSmith 配置(可选)启动服务应用场景