Skip to content

Commit 7b3b0b2

Browse files
Merge pull request #47 from contentstack/staging
DX | 03-11-2025 | Release
2 parents 7000fd4 + 1e96811 commit 7b3b0b2

File tree

4 files changed

+46
-37
lines changed

4 files changed

+46
-37
lines changed
Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
1+
# This workflow will build a package using Maven and then publish it to Maven Central using the new Central Publishing Plugin
22
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
33

44
name: Maven Package
@@ -8,32 +8,31 @@ on:
88
types: [created]
99

1010
jobs:
11-
build:
12-
11+
publish-maven:
1312
runs-on: ubuntu-latest
1413
permissions:
1514
contents: read
1615
packages: write
1716

1817
steps:
19-
- uses: actions/checkout@v3
20-
- name: Set up JDK 11
21-
uses: actions/setup-java@v3
22-
with:
23-
java-version: '11'
24-
distribution: 'temurin'
25-
server-id: ossrh
26-
server-username: MAVEN_USERNAME
27-
server-password: MAVEN_PASSWORD
28-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
29-
gpg-passphrase: GPG_PASSPHRASE
18+
- uses: actions/checkout@v3
19+
- name: Set up Maven Central Repository
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: '11'
23+
distribution: 'adopt'
24+
server-id: central
25+
server-username: MAVEN_USERNAME
26+
server-password: MAVEN_PASSWORD
27+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
28+
gpg-passphrase: GPG_PASSPHRASE
3029

31-
- name: Build with Maven
32-
run: mvn -B package --file pom.xml
30+
- name: Build with Maven
31+
run: mvn -B package --file pom.xml
3332

34-
- name: Publish to GitHub Packages Apache Maven
35-
run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy
36-
env:
37-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
38-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
39-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
33+
- name: Publish to the Maven Central Repository
34+
run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy
35+
env:
36+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
37+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
38+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/maven.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v3
24-
- name: Set up JDK 17
24+
- name: Set up JDK 11
2525
uses: actions/setup-java@v3
2626
with:
27-
java-version: '17'
27+
java-version: '11'
2828
distribution: 'temurin'
2929
cache: maven
3030
- name: Build with Maven

pom.xml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<groupId>com.contentstack.sdk</groupId>
77
<artifactId>marketplace</artifactId>
88
<version>1.0.3</version>
9+
<name>Contentstack Marketplace Java SDK</name>
910
<description>Contentstack Java Management SDK for Content Management API</description>
1011
<url>https://github.com/contentstack/contentstack-management-java/</url>
1112

@@ -33,7 +34,7 @@
3334
<maven-site-plugin.version>4.0.0-M9</maven-site-plugin.version>
3435
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
3536
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
36-
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
37+
<central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>
3738
<maven-release-plugin.version>3.0.1</maven-release-plugin.version>
3839
</properties>
3940

@@ -89,23 +90,21 @@
8990
</developer>
9091
</developers>
9192

93+
<!-- Old OSSRH/Nexus Configuration - Commented out for new Central Publishing -->
94+
<!--
9295
<distributionManagement>
9396
<snapshotRepository>
9497
<id>ossrh</id>
9598
<name>Apache Maven Packages Snapshot</name>
9699
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
97100
</snapshotRepository>
98-
<!-- <snapshotRepository>
99-
<id>github</id>
100-
<name>GitHub Apache Maven Packages</name>
101-
<url>https://maven.pkg.github.com/contentstack/contentstack-management-java</url>
102-
</snapshotRepository> -->
103101
<repository>
104102
<id>ossrh</id>
105103
<name>Apache Maven Packages Release</name>
106104
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
107105
</repository>
108106
</distributionManagement>
107+
-->
109108

110109

111110
<dependencies>
@@ -141,7 +140,7 @@
141140
<groupId>org.projectlombok</groupId>
142141
<artifactId>lombok</artifactId>
143142
<version>${lombok-source.version}</version>
144-
<scope>compile</scope>
143+
<scope>provided</scope>
145144
</dependency>
146145
<dependency>
147146
<groupId>io.github.cdimascio</groupId>
@@ -273,6 +272,13 @@
273272
<configuration>
274273
<source>8</source>
275274
<target>8</target>
275+
<annotationProcessorPaths>
276+
<path>
277+
<groupId>org.projectlombok</groupId>
278+
<artifactId>lombok</artifactId>
279+
<version>${lombok-source.version}</version>
280+
</path>
281+
</annotationProcessorPaths>
276282
<compilerArgument>-Xlint:all</compilerArgument>
277283
<showDeprecation>true</showDeprecation>
278284
<showWarnings>true</showWarnings>
@@ -281,15 +287,16 @@
281287
</compilerArgs>
282288
</configuration>
283289
</plugin>
290+
<!-- New Central Publishing Maven Plugin -->
284291
<plugin>
285-
<groupId>org.sonatype.plugins</groupId>
286-
<artifactId>nexus-staging-maven-plugin</artifactId>
287-
<version>${nexus-staging-maven-plugin.version}</version>
292+
<groupId>org.sonatype.central</groupId>
293+
<artifactId>central-publishing-maven-plugin</artifactId>
294+
<version>${central-publishing-maven-plugin.version}</version>
288295
<extensions>true</extensions>
289296
<configuration>
290-
<serverId>ossrh</serverId>
291-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
292-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
297+
<publishingServerId>central</publishingServerId>
298+
<autoPublish>true</autoPublish>
299+
<waitUntil>published</waitUntil>
293300
</configuration>
294301
</plugin>
295302
<plugin>

src/main/java/com/contentstack/sdk/marketplace/Marketplace.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public static class Builder {
4646

4747

4848
public Builder(@NotNull String organizationUid) {
49+
if (organizationUid == null) {
50+
throw new IllegalArgumentException(Constants.ERROR_NO_ORGANIZATION_UID);
51+
}
4952
if (organizationUid.isEmpty()) {
5053
throw new NullPointerException("Empty fields are not allowed");
5154
}

0 commit comments

Comments
 (0)