Skip to content

Commit c0e2975

Browse files
denglimingclaude
andcommitted
Publish through the Sonatype Central Portal instead of the retired OSSRH
s01.oss.sonatype.org was shut down in June 2025, so every snapshot and release deploy has failed since. Releases now go through central-publishing-maven-plugin (autoPublish, wait until published) and SNAPSHOTs to central.sonatype.com/repository/maven-snapshots/, both under the server id "central". The GPG signing profile is renamed to "release", which is the name maven-release-plugin already referenced. The workflows read CENTRAL_USERNAME / CENTRAL_PASSWORD, which must hold a Central Portal user token; the old OSSRH_* secrets no longer work. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 500d43c commit c0e2975

3 files changed

Lines changed: 27 additions & 14 deletions

File tree

‎.github/workflows/snapshot.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Publish Snapshot
2+
# Needs the CENTRAL_USERNAME / CENTRAL_PASSWORD secrets: a Sonatype Central Portal user token
3+
# (https://central.sonatype.com/account), with SNAPSHOT publishing enabled for the io.github.dengliming namespace.
24
on:
35
push:
46
branches:
@@ -17,12 +19,12 @@ jobs:
1719
java-version: '8'
1820
distribution: 'temurin'
1921
cache: 'maven'
20-
server-id: oss
22+
server-id: central
2123
server-username: MAVEN_USERNAME
2224
server-password: MAVEN_PASSWORD
2325
- name: deploy
2426
run: |
2527
mvn --no-transfer-progress -DskipTests deploy
2628
env:
27-
MAVEN_USERNAME: ${{secrets.OSSRH_USER}}
28-
MAVEN_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
29+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
30+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}

‎.github/workflows/version-and-release.yml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Release
2+
# Needs CENTRAL_USERNAME / CENTRAL_PASSWORD (Sonatype Central Portal user token) plus GPG_SECRET / GPG_PASSWORD.
23
on:
34
release:
45
types: [published]
@@ -17,7 +18,7 @@ jobs:
1718
java-version: '8'
1819
distribution: 'temurin'
1920
cache: 'maven'
20-
server-id: oss
21+
server-id: central
2122
server-username: MAVEN_USERNAME
2223
server-password: MAVEN_PASSWORD
2324

@@ -38,8 +39,8 @@ jobs:
3839
mvn --no-transfer-progress \
3940
--batch-mode \
4041
-Dgpg.passphrase='${{ secrets.GPG_PASSWORD }}' \
41-
-DskipTests deploy -P sonatype-oss-release
42+
-DskipTests deploy -P release
4243
4344
env:
44-
MAVEN_USERNAME: ${{secrets.OSSRH_USER}}
45-
MAVEN_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
45+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
46+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}

‎pom.xml‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
6060
<maven-shade-plugin.version>3.2.1</maven-shade-plugin.version>
6161
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
62+
<central-publishing-maven-plugin.version>0.11.0</central-publishing-maven-plugin.version>
6263
<jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
6364
<gpg-plugin.version>1.6</gpg-plugin.version>
6465
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
@@ -200,6 +201,18 @@
200201

201202
<build>
202203
<plugins>
204+
<!-- Publishes releases (and snapshots) through the Sonatype Central Portal; replaces the retired OSSRH. -->
205+
<plugin>
206+
<groupId>org.sonatype.central</groupId>
207+
<artifactId>central-publishing-maven-plugin</artifactId>
208+
<version>${central-publishing-maven-plugin.version}</version>
209+
<extensions>true</extensions>
210+
<configuration>
211+
<publishingServerId>central</publishingServerId>
212+
<autoPublish>true</autoPublish>
213+
<waitUntil>published</waitUntil>
214+
</configuration>
215+
</plugin>
203216
<plugin>
204217
<groupId>org.apache.maven.plugins</groupId>
205218
<artifactId>maven-release-plugin</artifactId>
@@ -303,7 +316,7 @@
303316

304317
<profiles>
305318
<profile>
306-
<id>sonatype-oss-release</id>
319+
<id>release</id>
307320
<build>
308321
<plugins>
309322
<plugin>
@@ -332,13 +345,10 @@
332345
</profiles>
333346

334347
<distributionManagement>
348+
<!-- SNAPSHOT deploys go straight to the Central Portal snapshot repository (must be enabled for the namespace) -->
335349
<snapshotRepository>
336-
<id>oss</id>
337-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
350+
<id>central</id>
351+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
338352
</snapshotRepository>
339-
<repository>
340-
<id>oss</id>
341-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
342-
</repository>
343353
</distributionManagement>
344354
</project>

0 commit comments

Comments
 (0)