Skip to content

Commit 31fa609

Browse files
Switch to Central Publisher Portal for Maven publishing
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent 8da9c33 commit 31fa609

3 files changed

Lines changed: 16 additions & 20 deletions

File tree

.github/workflows/maven-publish-snapshot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919
java-version: "17"
2020
distribution: "temurin"
2121
cache: maven
22-
server-id: ossrh
22+
server-id: central
2323
server-username: MAVEN_USERNAME
2424
server-password: MAVEN_PASSWORD
2525

2626
- name: Publish snapshot package
2727
run: mvn -B deploy --file pom.xml
2828
env:
29-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
30-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
29+
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
30+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
3131
- name: Generate Javadoc
3232
run: mvn -B javadoc:javadoc --file pom.xml # This checks that the Javadoc is vaild

.github/workflows/maven-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
java-version: "17"
1717
distribution: "temurin"
1818
cache: maven
19-
server-id: ossrh
19+
server-id: central
2020
server-username: MAVEN_USERNAME
2121
server-password: MAVEN_PASSWORD
2222
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
@@ -27,6 +27,6 @@ jobs:
2727
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
2828
mvn -B -batch-mode release:prepare release:perform --file pom.xml
2929
env:
30-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
31-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
30+
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
31+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
3232
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

pom.xml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@
181181
</executions>
182182
</plugin>
183183
<plugin>
184-
<groupId>org.sonatype.plugins</groupId>
185-
<artifactId>nexus-staging-maven-plugin</artifactId>
186-
<version>1.7.0</version>
184+
<groupId>org.sonatype.central</groupId>
185+
<artifactId>central-publishing-maven-plugin</artifactId>
186+
<version>0.6.0</version>
187187
<extensions>true</extensions>
188188
<configuration>
189-
<serverId>ossrh</serverId>
190-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
191-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
189+
<publishingServerId>central</publishingServerId>
190+
<autoPublish>true</autoPublish>
191+
<waitUntil>published</waitUntil>
192192
</configuration>
193193
</plugin>
194194
<plugin>
@@ -301,13 +301,9 @@
301301
</dependencyManagement>
302302
<distributionManagement>
303303
<snapshotRepository>
304-
<id>ossrh</id>
305-
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
304+
<id>central</id>
305+
<url>https://central.sonatype.com/api/v1/publisher/deployments/download/</url>
306306
</snapshotRepository>
307-
<repository>
308-
<id>ossrh</id>
309-
<url>https://ossrh-staging-api.central.sonatype.com/service/local/</url>
310-
</repository>
311307
</distributionManagement>
312308
<profiles>
313309
<profile>
@@ -327,8 +323,8 @@
327323
<artifactId>maven-gpg-plugin</artifactId>
328324
</plugin>
329325
<plugin>
330-
<groupId>org.sonatype.plugins</groupId>
331-
<artifactId>nexus-staging-maven-plugin</artifactId>
326+
<groupId>org.sonatype.central</groupId>
327+
<artifactId>central-publishing-maven-plugin</artifactId>
332328
</plugin>
333329
</plugins>
334330
</build>

0 commit comments

Comments
 (0)