在https://central.sonatype.com注冊 賬號
- 建議用github直接登錄,因為在創(chuàng)建namespace的時候需要去驗證,直接用github可以很快的驗證結(jié)束。
-可能遇到的問題 創(chuàng)建namespace失敗,大概換成github登錄就好了。
用GPG生成秘鑰
- 下載地址:https://www.gnupg.org/download/index.html
- 生成證書 (先把GPG添加到環(huán)境變量中去)
$ gpg --gen-key -
查詢生成的證書
image.png - 上傳公鑰到公鑰服務器
$ gpg --keyserver keyserver.ubuntu.com --send-keys 你的公鑰
推送階段
- 配置 url
<url>https://github.com/xxx/yyy</url> - 配置 license
<issueManagement>
<system>github</system>
<url>https://github.com/xxx/yyy/issues</url>
</issueManagement>
- 配置 issueManagement
<system>github</system>
<url>https://github.com/xxx/yyy/issues</url>
</issueManagement>
- 配置 SCM
<scm>
<connection>scm:git:https://github.com/xxx/yyy.git</connection>
<developerConnection>scm:git:https://github.com/xxx/yyy.git</developerConnection>
<url>https://github.com/xxx/yyy</url>
</scm>
- settings.xml 文件配置
<servers>
<server>
<id>central</id>
<username>xxx</username>
<password>yyy</password>
</server>
</servers>
<profiles>
<profile>
<id>gpg</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>xxx@zzz.com</gpg.keyname>
<gpg.passphrase>passphrase</gpg.passphrase>
<gpg.useagent>true</gpg.useagent>
</properties>
</profile>
</profiles>
其中username和password是在sonatype上生成的令牌

image.png
-
執(zhí)行構(gòu)建并上傳
$ mvn clean deploy -Prelease
或者在IDEA 上 點擊 depely直接上傳
image.png -
上傳結(jié)果
image.png


