如何发布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

相关文章

Mac系统下卸载JAVA和JDK的步骤

《Mac系统下卸载JAVA和JDK的步骤》JDK是Java语言的软件开发工具包,它提供了开发和运行Java应用程序所需的工具、库和资源,:本文主要介绍Mac系统下卸载JAVA和JDK的相关资料,需... 目录1. 卸载系统自带的 Java 版本检查当前 Java 版本通过命令卸载系统 Java2. 卸载自定

SQL Server修改数据库名及物理数据文件名操作步骤

《SQLServer修改数据库名及物理数据文件名操作步骤》在SQLServer中重命名数据库是一个常见的操作,但需要确保用户具有足够的权限来执行此操作,:本文主要介绍SQLServer修改数据... 目录一、背景介绍二、操作步骤2.1 设置为单用户模式(断开连接)2.2 修改数据库名称2.3 查找逻辑文件名

canal实现mysql数据同步的详细过程

《canal实现mysql数据同步的详细过程》:本文主要介绍canal实现mysql数据同步的详细过程,本文通过实例图文相结合给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的... 目录1、canal下载2、mysql同步用户创建和授权3、canal admin安装和启动4、canal

Maven 配置中的 <mirror>绕过 HTTP 阻断机制的方法

《Maven配置中的<mirror>绕过HTTP阻断机制的方法》:本文主要介绍Maven配置中的<mirror>绕过HTTP阻断机制的方法,本文给大家分享问题原因及解决方案,感兴趣的朋友一... 目录一、问题场景:升级 Maven 后构建失败二、解决方案:通过 <mirror> 配置覆盖默认行为1. 配置示

使用SpringBoot整合Sharding Sphere实现数据脱敏的示例

《使用SpringBoot整合ShardingSphere实现数据脱敏的示例》ApacheShardingSphere数据脱敏模块,通过SQL拦截与改写实现敏感信息加密存储,解决手动处理繁琐及系统改... 目录痛点一:痛点二:脱敏配置Quick Start——Spring 显示配置:1.引入依赖2.创建脱敏

maven私服配置全过程

《maven私服配置全过程》:本文主要介绍maven私服配置全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录使用Nexus作为 公司maven私服maven 私服setttings配置maven项目 pom配置测试效果总结使用Nexus作为 公司maven私

基于Python实现一个简单的题库与在线考试系统

《基于Python实现一个简单的题库与在线考试系统》在当今信息化教育时代,在线学习与考试系统已成为教育技术领域的重要组成部分,本文就来介绍一下如何使用Python和PyQt5框架开发一个名为白泽题库系... 目录概述功能特点界面展示系统架构设计类结构图Excel题库填写格式模板题库题目填写格式表核心数据结构

Linux系统中的firewall-offline-cmd详解(收藏版)

《Linux系统中的firewall-offline-cmd详解(收藏版)》firewall-offline-cmd是firewalld的一个命令行工具,专门设计用于在没有运行firewalld服务的... 目录主要用途基本语法选项1. 状态管理2. 区域管理3. 服务管理4. 端口管理5. ICMP 阻断

安装centos8设置基础软件仓库时出错的解决方案

《安装centos8设置基础软件仓库时出错的解决方案》:本文主要介绍安装centos8设置基础软件仓库时出错的解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录安装Centos8设置基础软件仓库时出错版本 8版本 8.2.200android4版本 javas

Linux使用scp进行远程目录文件复制的详细步骤和示例

《Linux使用scp进行远程目录文件复制的详细步骤和示例》在Linux系统中,scp(安全复制协议)是一个使用SSH(安全外壳协议)进行文件和目录安全传输的命令,它允许在远程主机之间复制文件和目录,... 目录1. 什么是scp?2. 语法3. 示例示例 1: 复制本地目录到远程主机示例 2: 复制远程主