Skip to content

Commit d3983e3

Browse files
committed
Migrate from OSSRH publishing to Sonatype Central Portal publishing
1 parent cbb8640 commit d3983e3

File tree

3 files changed

+41
-53
lines changed

3 files changed

+41
-53
lines changed

.github/settings.xml

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
44
<servers>
55
<server>
6-
<id>ossrh</id>
7-
<username>${env.OSSRHU}</username>
8-
<password>${env.OSSRHT}</password>
6+
<id>sonatype-central-portal</id>
7+
<username>${env.SONATYPE_CENTRAL_PORTAL_REPO_USERNAME}</username>
8+
<password>${env.SONATYPE_CENTRAL_PORTAL_REPO_PASSWORD}</password>
99
</server>
1010
</servers>
1111
<profiles>
@@ -16,44 +16,17 @@
1616
</properties>
1717
</profile>
1818
<profile>
19-
<id>sonatype-snapshots</id>
19+
<id>sonatype-central-snapshots</id>
2020
<repositories>
2121
<repository>
22-
<id>sonatype-snapshots</id>
22+
<id>sonatype-central-snapshots</id>
2323
<snapshots>
2424
<enabled>true</enabled>
2525
</snapshots>
26-
<name>sonatype-snapshots</name>
27-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
28-
</repository>
29-
</repositories>
30-
</profile>
31-
<profile>
32-
<id>sonatype-staging</id>
33-
<repositories>
34-
<repository>
35-
<id>sonatype-staging</id>
36-
<snapshots>
37-
<enabled>true</enabled>
38-
</snapshots>
39-
<name>sonatype-staging</name>
40-
<url>https://oss.sonatype.org/content/groups/staging/</url>
41-
</repository>
42-
</repositories>
43-
</profile>
44-
<profile>
45-
<id>sonatype-releases</id>
46-
<repositories>
47-
<repository>
48-
<id>sonatype-releases</id>
49-
<snapshots>
50-
<enabled>true</enabled>
51-
</snapshots>
52-
<name>sonatype-releases</name>
53-
<url>https://oss.sonatype.org/content/groups/public/</url>
26+
<name>sonatype-central-snapshots</name>
27+
<url>https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/snapshots/</url>
5428
</repository>
5529
</repositories>
5630
</profile>
5731
</profiles>
58-
5932
</settings>

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ${{ matrix.os }}
2626
env:
2727
MAVEN_PROPS: -Djavadoc.path=`which javadoc`
28-
PROFILES: gpg,release-sign-artifacts,sonatype-deployment,sonatype-snapshots,sonatype-staging,sonatype-releases
28+
PROFILES: "gpg,release-sign-artifacts,sonatype-central-portal-deployment,sonatype-central-snapshots"
2929
SETTINGS: .github/settings.xml
3030

3131
steps:
@@ -82,8 +82,8 @@ jobs:
8282
- name: Maven deploy
8383
if: ${{ matrix.maven_deploy && (github.ref == 'refs/heads/main') && (github.event_name != 'pull_request') }}
8484
env:
85-
OSSRHU: ${{ secrets.OSSRHU }}
86-
OSSRHT: ${{ secrets.OSSRHT }}
85+
SONATYPE_CENTRAL_PORTAL_REPO_USERNAME: ${{ secrets.SONATYPE_CENTRAL_PORTAL_REPO_USERNAME }}
86+
SONATYPE_CENTRAL_PORTAL_REPO_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_PORTAL_REPO_PASSWORD }}
8787
run: ./mvnw -U -V -s ${{ env.SETTINGS }} -P${{ env.PROFILES }} ${{ env.MAVEN_PROPS }} deploy
8888

8989
- name: Docker maven build

pom.xml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@
461461
<autoVersionSubmodules>true</autoVersionSubmodules>
462462
<localCheckout>true</localCheckout>
463463
<pushChanges>false</pushChanges>
464-
<releaseProfiles>release-sign-artifacts,sonatype-deployment</releaseProfiles>
464+
<releaseProfiles>release-sign-artifacts,sonatype-central-portal-deployment</releaseProfiles>
465465
</configuration>
466466
</plugin>
467467
<plugin>
@@ -859,10 +859,10 @@
859859
</build>
860860
</profile>
861861
<!--
862-
The release-sign-artifacts and sonatype deployment profiles only need activated when pushing snapshots or
863-
releases to maven central. When enabled, additional artifacts will be generated for javadoc and source as well
864-
as GPG signatures for each artifact. This profiles assume that the properties for the gpg plugin
865-
(such as gpg.keyname and gpg.passphrase are either defined in a settings.xml file or similar facility.
862+
The release-sign-artifacts and sonatype-central-portal-deployment profiles only need activated when pushing
863+
snapshots or releases to maven central. When enabled, additional artifacts will be generated for javadoc and
864+
source as well as GPG signatures for each artifact. These profiles assume that the properties for the gpg
865+
plugin (such as gpg.keyname and gpg.passphrase) are either defined in a settings.xml file or similar facility.
866866
-->
867867
<profile>
868868
<id>release-sign-artifacts</id>
@@ -909,17 +909,32 @@
909909
</build>
910910
</profile>
911911
<profile>
912-
<id>sonatype-deployment</id>
913-
<distributionManagement>
914-
<snapshotRepository>
915-
<id>ossrh</id>
916-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
917-
</snapshotRepository>
918-
<repository>
919-
<id>ossrh</id>
920-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
921-
</repository>
922-
</distributionManagement>
912+
<id>sonatype-central-portal-deployment</id>
913+
<properties>
914+
<central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
915+
</properties>
916+
<build>
917+
<pluginManagement>
918+
<plugins>
919+
<plugin>
920+
<groupId>org.sonatype.central</groupId>
921+
<artifactId>central-publishing-maven-plugin</artifactId>
922+
<version>${central-publishing-maven-plugin.version}</version>
923+
<extensions>true</extensions>
924+
<configuration>
925+
<!-- publishing server id refers to <id> element in <server> section of settings.xml -->
926+
<publishingServerId>sonatype-central-portal</publishingServerId>
927+
</configuration>
928+
</plugin>
929+
</plugins>
930+
</pluginManagement>
931+
<plugins>
932+
<plugin>
933+
<groupId>org.sonatype.central</groupId>
934+
<artifactId>central-publishing-maven-plugin</artifactId>
935+
</plugin>
936+
</plugins>
937+
</build>
923938
</profile>
924939

925940
<profile>

0 commit comments

Comments
 (0)