Java开源开发者指南:构建并部署到Maven Central
目录
- 创建GitHub帐户(如果还没有)
- 申请Maven Central Repository帐户
- Java Doc
- 发布设定(Deployment Config)
- GPG
- 开发者资讯(Developer Information)
- 源程式码管理(SCM)
- 版权宣告(Licenses)
- 范例POM档
Sign maven central repository
注册Namespace
请务必以github进行登入,这样就可以有免费的namespace可以用
原文
If you do not see this pop-up AND you signed up with GitHub, then Sonatype was able to grant you permissions to the namespace associated with your GitHub identity automatically. As part of your GitHub subscription, GitHub provides you with a github.io domain that reflects your username and allows you to publish GitHub Pages under that domain. Because of this, Sonatype can, in most cases, automatically verify and provision publishing access to a namespace that looks like io.github..
Deployment config
找到namespace
务必确保资料一致
<groupId>io.github.internetms52</groupId> <artifactId>object-pool</artifactId> <version>0.1.3</version> <name>object-pool</name> <packaging>jar</packaging> <url>https://github.com/internetms52/object-pool-maven-lib</url> <description>This is a library that implements an Object Pool, and it supports nested object creation as well as constructor specification.</description>
Generate User Token
View Account > Generate User Token
完成后就会取得settings.xml所需的资讯
指定server(settings.xml)
<settings> <servers> <server> <id>central</id> <username>XXXXXX</username> <password>YYYYYY</password> </server> </servers> </settings>
指定maven central repository server设定(pom.xml)
<plugin> <groupId>org.sonatype.central</groupId> <artifactId>central-publishing-maven-plugin</artifactId> <version>0.5.0</version> <extensions>true</extensions> <configuration> <publishingServerId>central</publishingServerId> </configuration> </plugin>
Java doc
使用Maven Plugin产生Java Doc
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.2.0</version> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>
GPG
产生GPG Key Pair
sudo apt-get install gnupg gpg --full-generate-key gpg --list-keys
GPG签名plugin
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-gpg-plugin</artifactId> <version>3.0.1</version> <executions> <execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal> </goals> <configuration> <gpgArguments> <arg>--pinentry-mode</arg> <arg>loopback</arg> </gpgArguments> </configuration> </execution> </executions> </plugin>
上传GPG公钥
GPG的公钥server有两个比较有名的
- pgp.mit.edu
- keyserver.ubuntu.com
gpg --keyserver hkp://pgp.mit.edu --send-keys F1BD06AB06C36BD5EB53B6E8710DEC40549547D2 gpg: sending key 710DEC40549547D2 to hkp://pgp.mit.edu gpg --keyserver hkp://keyserver.ubuntu.com --send-keys F1BD06AB06C36BD5EB53B6E8710DEC40549547D2 gpg: sending key 710DEC40549547D2 to hkp://keyserver.ubuntu.com
Developer info
<developers> <developer> <name>LU.YU HSIN</name> <email>yourmail@mail.com</email> <organization>internetms52</organization> <organizationUrl>https://github.com/internetms52/object-pool-maven-lib</organizationUrl> </developer> </developers>
SCM
<scm> <connection>scm:git:git@github.com:internetms52/object-pool-maven-lib.git</connection> <developerConnection>scm:git:git@github.com:internetms52/object-pool-maven-lib.git</developerConnection> <url>https://github.com/internetms52/object-pool-maven-lib</url> </scm>
Licenses
<licenses> <license> <name>Apache License, Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <distribution>repo</distribution> </license> </licenses>
Example POM
object-pool-maven-lib
以上是Java开源开发者指南:构建并部署到Maven Central的详细内容。更多信息请关注PHP中文网其他相关文章!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

公司安全软件导致部分应用无法正常运行的排查与解决方法许多公司为了保障内部网络安全,会部署安全软件。...

将姓名转换为数字以实现排序的解决方案在许多应用场景中,用户可能需要在群组中进行排序,尤其是在一个用...

系统对接中的字段映射处理在进行系统对接时,常常会遇到一个棘手的问题:如何将A系统的接口字段有效地映�...

在使用IntelliJIDEAUltimate版本启动Spring...

在使用MyBatis-Plus或其他ORM框架进行数据库操作时,经常需要根据实体类的属性名构造查询条件。如果每次都手动...

Java对象与数组的转换:深入探讨强制类型转换的风险与正确方法很多Java初学者会遇到将一个对象转换成数组的�...

电商平台SKU和SPU表设计详解本文将探讨电商平台中SKU和SPU的数据库设计问题,特别是如何处理用户自定义销售属...

Redis缓存方案如何实现产品排行榜列表的需求?在开发过程中,我们常常需要处理排行榜的需求,例如展示一个�...
