# 把自己的开源项目的Jar包上传到maven中央仓库

主要参考这篇文章:【maven】手把手教你如何把自己的Jar上传到maven中央仓库 (opens new window),这篇文章也写得很详细了。这里就记录一下自己遇到的一些其它问题吧。

# Mac没有gpg

需要安装:https://formulae.brew.sh/formula/gnupg

# maven密码有特殊字符&,需要处理:

<server>
  <id>ossrh</id>
  <username>larrydpk</username>
  <password><![CDATA[xxxxxxx*xxxs&]]></password>
</server>

# build包签名报错:gpg: signing failed: Inappropriate ioctl for device

export GPG_TTY=$(tty)

参考:https://stackoverflow.com/questions/57591432/gpg-signing-failed-inappropriate-ioctl-for-device-on-macos-with-maven

# keyserver服务器地址不同

$ gpg --keyserver keyserver.ubuntu.com --send-keys 84FAB0F2DFB42987F6A6FD53BB550D6FE75B179C
gpg: sending key BB550D6FE75B179C to hkp://keyserver.ubuntu.com

$ gpg --keyserver keyserver.ubuntu.com --recv-keys 84FAB0F2DFB42987F6A6FD53BB550D6FE75B179C
gpg: key BB550D6FE75B179C: "Larry Deng <larry.dpk@gmail.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

# 查看仓库

Sonatype (opens new window)

# Release包同步后,可查看下面地址

# 参考仓库

Pom.xml可以参考: LarryDpk/Google-Bard (opens new window)


References:

Ticket (opens new window)

https://maciejwalkowiak.com/blog/guide-java-publish-to-maven-central/

上次更新: 2023/8/18 23:39:36