注册

提出工单

image

查看审核记录

image

gpg密钥

下载位置

sh
1
2
3
4
5
6
7
# 密钥生成
gpg --gen-key
# 上传公钥
gpg --keyserver hkp://keyserver.ubuntu.com:80 --send-keys 公钥

# 查看公钥是否上传成功
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 公钥

配置maven setting.xml

xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>sonatype账号</username>
<password>sonatype密码</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>sonatype账号</username>
<password>sonatype密码</password>
</server>
</servers>
<mirrors>
</mirrors>
<profiles>
<profile>
<id>gpg</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>生成gpg时设置的密码</gpg.passphrase>
</properties>
</profile>
</profiles>

<activeProfiles>
<activeProfile>gpg</activeProfile>
</activeProfiles>

</settings>

配置环境变量应对javadoc检查

image

plaintext
1
2
JAVA_TOOL_OPTIONS
-Dfile.encoding=UTF-8

配置pom.xml

xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<tag>版本号</tag>
<url>git@github.com:chenqi92/allbs-utils-core.git</url>
<connection>scm:git:git@github.com:chenqi92/allbs-utils-core.git</connection>
<developerConnection>scm:git:git@github.com:chenqi92/allbs-utils-core.git</developerConnection>
</scm>
<developers>
<developer>
<name>chenQi</name>
<email>cq92104@outlook.com</email>
<organization>allbs</organization>
</developer>
</developers>

<build>
<plugins>
<!-- doc plugin,Maven API文档生成插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.0</version>
<!-- javadoc检查跳过 -->
<configuration>
<failOnError>false</failOnError>
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- resources plugin,Maven 资源插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- compiler plugin,Maven 编译插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<!-- gpg plugin,用于签名认证 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<!--staging puglin,用于自动执行发布阶段(免手动)-->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-snapshots</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<!-- release plugin,用于发布到release仓库部署插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
</plugin>
</plugins>
</build>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

执行上传命令

sh
1
mvn clean deploy

如果显示build success 则说明上传并发布成功

image

image

如果自动发布失败

登录

执行以下步骤

image-20220902175005177