Skip to content

Commit fbd172b

Browse files
author
zhanq
committed
update pom.
1 parent a919a80 commit fbd172b

File tree

2 files changed

+155
-51
lines changed

2 files changed

+155
-51
lines changed

.github/workflows/maven.yml

+24-16
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
name: Publish package to the Maven Central Repository
22
on:
33
release:
4-
types: [released]
4+
types: [published]
5+
56
jobs:
67
publish:
78
runs-on: ubuntu-latest
9+
810
steps:
911
- uses: actions/checkout@v2
10-
- name: Set up Maven Central Repository
11-
uses: actions/setup-java@v2
12+
- name: Set up JDK 1.8
13+
uses: actions/setup-java@v1
1214
with:
13-
java-version: '8'
14-
distribution: 'adopt'
15-
server-id: ossrh
16-
server-username: MAVEN_USERNAME
17-
server-password: MAVEN_PASSWORD
18-
- id: install-secret-key
19-
name: Install gpg secret key
20-
run: |
21-
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
22-
gpg --list-secret-keys --keyid-format LONG
23-
- name: Publish package
15+
java-version: 1.8
16+
17+
- name: Build with Maven
18+
run: mvn -B clean package -Dmaven.test.skip
19+
20+
- name: Set up Apache Maven Central
21+
uses: actions/setup-java@v1
22+
with: # running setup-java again overwrites the settings.xml
23+
java-version: 1.8
24+
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
25+
server-username: MAVEN_USERNAME # env variable for username in deploy
26+
server-password: MAVEN_PASSWORD # env variable for token in deploy
27+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
28+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
29+
30+
- name: Publish to Apache Maven Central
31+
run: mvn -X deploy -Dmaven.test.skip
2432
env:
2533
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
26-
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
27-
run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} clean deploy
34+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
35+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

pom.xml

+131-35
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@
4242
<groupId>org.apache.httpcomponents</groupId>
4343
<artifactId>httpclient</artifactId>
4444
<version>4.5.3</version>
45-
<scope>provided</scope>
45+
<scope>provided</scope>
46+
</dependency>
47+
<dependency>
48+
<groupId>io.netty</groupId>
49+
<artifactId>netty-all</artifactId>
50+
<version>4.1.6.Final</version>
51+
<scope>provided</scope>
4652
</dependency>
47-
<dependency>
48-
<groupId>io.netty</groupId>
49-
<artifactId>netty-all</artifactId>
50-
<version>4.1.6.Final</version>
51-
<scope>provided</scope>
52-
</dependency>
5353
<dependency>
5454
<groupId>com.squareup.okhttp3</groupId>
5555
<artifactId>okhttp</artifactId>
5656
<version>3.3.1</version>
57-
<scope>provided</scope>
57+
<scope>provided</scope>
5858
</dependency>
5959

6060
<dependency>
@@ -68,19 +68,19 @@
6868
<groupId>org.slf4j</groupId>
6969
<artifactId>slf4j-api</artifactId>
7070
<version>1.7.7</version>
71-
<scope>provided</scope>
71+
<scope>provided</scope>
7272
</dependency>
7373

74-
<dependency>
75-
<groupId>org.bouncycastle</groupId>
76-
<artifactId>bcprov-jdk15on</artifactId>
77-
<version>1.60</version>
78-
</dependency>
79-
<dependency>
80-
<groupId>org.bouncycastle</groupId>
81-
<artifactId>bcpkix-jdk15on</artifactId>
82-
<version>1.60</version>
83-
</dependency>
74+
<dependency>
75+
<groupId>org.bouncycastle</groupId>
76+
<artifactId>bcprov-jdk15on</artifactId>
77+
<version>1.60</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.bouncycastle</groupId>
81+
<artifactId>bcpkix-jdk15on</artifactId>
82+
<version>1.60</version>
83+
</dependency>
8484

8585
<!-- Test Dependencies -->
8686

@@ -107,17 +107,73 @@
107107

108108
<build>
109109
<plugins>
110+
110111
<plugin>
111-
<groupId>org.sonatype.plugins</groupId>
112-
<artifactId>nexus-staging-maven-plugin</artifactId>
113-
<version>1.6.7</version>
114-
<extensions>true</extensions>
112+
<groupId>org.apache.maven.plugins</groupId>
113+
<artifactId>maven-release-plugin</artifactId>
114+
<version>2.5.1</version>
115+
</plugin>
116+
117+
<plugin>
118+
<artifactId>maven-compiler-plugin</artifactId>
119+
<version>3.5.1</version>
115120
<configuration>
116-
<serverId>ossrh</serverId>
117-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
118-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
121+
<source>${jdkVersion}</source>
122+
<target>${jdkVersion}</target>
123+
<compilerVersion>1.5</compilerVersion>
124+
<showDeprecation>true</showDeprecation>
125+
<showWarnings>true</showWarnings>
126+
<debug>true</debug>
127+
<fork>true</fork>
128+
<compilerArgs>
129+
<arg>-Xlint:unchecked</arg>
130+
</compilerArgs>
131+
</configuration>
132+
</plugin>
133+
134+
<plugin>
135+
<groupId>com.github.github</groupId>
136+
<artifactId>site-maven-plugin</artifactId>
137+
<version>0.12</version>
138+
<configuration>
139+
<message>Creating site for ${project.version}</message>
140+
<server>github</server>
141+
</configuration>
142+
<executions>
143+
<execution>
144+
<goals>
145+
<goal>site</goal>
146+
</goals>
147+
<phase>site</phase>
148+
</execution>
149+
</executions>
150+
</plugin>
151+
152+
<plugin>
153+
<groupId>org.apache.maven.plugins</groupId>
154+
<artifactId>maven-surefire-plugin</artifactId>
155+
<version>2.17</version>
156+
<configuration>
157+
<groups>cn.jpush.api.FastTests</groups>
158+
<argLine>-Dfile.encoding=UTF-8</argLine>
159+
<excludes>
160+
<exclude>**/mock/*Test.java</exclude>
161+
</excludes>
119162
</configuration>
163+
<dependencies>
164+
<dependency>
165+
<groupId>org.apache.maven.surefire</groupId>
166+
<artifactId>surefire-junit47</artifactId>
167+
<version>2.17</version>
168+
</dependency>
169+
</dependencies>
120170
</plugin>
171+
172+
<!-- 参考 https://docs.github.com/cn/actions/language-and-framework-guides/publishing-java-packages-with-maven#about-package-configuration -->
173+
<!-- 参考 https://github.com/actions/setup-java -->
174+
<!-- 参考 https://central.sonatype.org/pages/apache-maven.html -->
175+
176+
<!-- Javadoc和源代码附件 -->
121177
<plugin>
122178
<groupId>org.apache.maven.plugins</groupId>
123179
<artifactId>maven-source-plugin</artifactId>
@@ -144,6 +200,8 @@
144200
</execution>
145201
</executions>
146202
</plugin>
203+
204+
<!-- GPG签名组件 -->
147205
<plugin>
148206
<groupId>org.apache.maven.plugins</groupId>
149207
<artifactId>maven-gpg-plugin</artifactId>
@@ -155,28 +213,66 @@
155213
<goals>
156214
<goal>sign</goal>
157215
</goals>
158-
<configuration>
159-
<!-- Prevent gpg from using pinentry programs -->
160-
<gpgArguments>
161-
<arg>--pinentry-mode</arg>
162-
<arg>loopback</arg>
163-
</gpgArguments>
164-
</configuration>
165216
</execution>
166217
</executions>
167218
</plugin>
219+
220+
<!-- Nexus Staging Maven插件,用于部署和发布 -->
221+
<plugin>
222+
<groupId>org.sonatype.plugins</groupId>
223+
<artifactId>nexus-staging-maven-plugin</artifactId>
224+
<version>1.6.7</version>
225+
<extensions>true</extensions>
226+
<configuration>
227+
<serverId>ossrh</serverId>
228+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
229+
<!-- 手动release -->
230+
<autoReleaseAfterClose>false</autoReleaseAfterClose>
231+
</configuration>
232+
</plugin>
233+
168234
</plugins>
169235
</build>
170236

171237
<distributionManagement>
172238
<snapshotRepository>
173239
<id>ossrh</id>
174-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
240+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
175241
</snapshotRepository>
176242
<repository>
177243
<id>ossrh</id>
178244
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
179245
</repository>
180246
</distributionManagement>
181247

182-
</project>
248+
<reporting>
249+
<plugins>
250+
251+
<plugin>
252+
<groupId>org.apache.maven.plugins</groupId>
253+
<artifactId>maven-project-info-reports-plugin</artifactId>
254+
<version>2.8.1</version>
255+
<reportSets>
256+
<reportSet>
257+
<reports>
258+
<report>dependencies</report>
259+
<report>license</report>
260+
<report>scm</report>
261+
</reports>
262+
</reportSet>
263+
</reportSets>
264+
</plugin>
265+
266+
<plugin>
267+
<groupId>org.apache.maven.plugins</groupId>
268+
<artifactId>maven-javadoc-plugin</artifactId>
269+
<version>2.10.3</version>
270+
<configuration>
271+
<overview>resources/javadoc-overview.html</overview>
272+
</configuration>
273+
</plugin>
274+
275+
</plugins>
276+
</reporting>
277+
278+
</project>

0 commit comments

Comments
 (0)