Skip to content

Commit df8fa91

Browse files
committed
Configured publishing to Maven Central
1 parent 771db4c commit df8fa91

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ target
1616

1717
# Test variables
1818
.env
19+
20+
# Maven Central artifacts
21+
.flattened-pom.xml

library/pom.xml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,32 @@
1111
<artifactId>oauth2-client-java</artifactId>
1212
<packaging>jar</packaging>
1313

14+
<name>${project.artifactId}</name>
15+
<description>Access Mastercard APIs with OAuth 2.0 and FAPI 2.0</description>
16+
<url>https://github.com/Mastercard/oauth2-client-java</url>
17+
18+
<licenses>
19+
<license>
20+
<name>The Apache License, Version 2.0</name>
21+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
22+
</license>
23+
</licenses>
24+
25+
<developers>
26+
<developer>
27+
<name>Mastercard Developers</name>
28+
<organization>Mastercard</organization>
29+
<organizationUrl>https://developers.mastercard.com</organizationUrl>
30+
</developer>
31+
</developers>
32+
33+
<scm>
34+
<connection>scm:git:git://github.com/Mastercard/oauth2-client-java.git</connection>
35+
<developerConnection>scm:git:git@github.com:Mastercard/oauth2-client-java.git</developerConnection>
36+
<url>https://github.com/Mastercard/oauth2-client-java</url>
37+
</scm>
38+
39+
1440
<properties>
1541
<!-- Latest versions supported (as of January 2026) -->
1642
<okhttp.version>5.3.2</okhttp.version>
@@ -174,6 +200,32 @@
174200
<release>17</release>
175201
</configuration>
176202
</plugin>
203+
<plugin>
204+
<!-- Flatten POM for Maven Central deployment (no parent reference) -->
205+
<groupId>org.codehaus.mojo</groupId>
206+
<artifactId>flatten-maven-plugin</artifactId>
207+
<version>1.7.3</version>
208+
<configuration>
209+
<updatePomFile>true</updatePomFile>
210+
<flattenMode>oss</flattenMode>
211+
</configuration>
212+
<executions>
213+
<execution>
214+
<id>flatten</id>
215+
<phase>process-resources</phase>
216+
<goals>
217+
<goal>flatten</goal>
218+
</goals>
219+
</execution>
220+
<execution>
221+
<id>flatten.clean</id>
222+
<phase>clean</phase>
223+
<goals>
224+
<goal>clean</goal>
225+
</goals>
226+
</execution>
227+
</executions>
228+
</plugin>
177229
<plugin>
178230
<!-- Write a "VERSION" file into target/classes -->
179231
<groupId>org.apache.maven.plugins</groupId>
@@ -247,6 +299,23 @@
247299
</execution>
248300
</executions>
249301
</plugin>
302+
<plugin>
303+
<!-- Attach source code -->
304+
<groupId>org.apache.maven.plugins</groupId>
305+
<artifactId>maven-source-plugin</artifactId>
306+
<version>3.4.0</version>
307+
<configuration>
308+
<attach>true</attach>
309+
</configuration>
310+
<executions>
311+
<execution>
312+
<id>attach-sources</id>
313+
<goals>
314+
<goal>jar-no-fork</goal>
315+
</goals>
316+
</execution>
317+
</executions>
318+
</plugin>
250319
<plugin>
251320
<!-- Javadoc JAR for https://www.javadoc.io/ -->
252321
<groupId>org.apache.maven.plugins</groupId>
@@ -266,6 +335,25 @@
266335
</execution>
267336
</executions>
268337
</plugin>
338+
<plugin>
339+
<!-- GPG signing for Maven Central deployment -->
340+
<groupId>org.apache.maven.plugins</groupId>
341+
<artifactId>maven-gpg-plugin</artifactId>
342+
<version>3.2.8</version>
343+
<configuration>
344+
<!-- Mastercard PGP key ID -->
345+
<keyname>BA52E056C094571E6577EAED65AA8812882B653A</keyname>
346+
</configuration>
347+
<executions>
348+
<execution>
349+
<id>sign-artifacts</id>
350+
<phase>package</phase>
351+
<goals>
352+
<goal>sign</goal>
353+
</goals>
354+
</execution>
355+
</executions>
356+
</plugin>
269357
</plugins>
270358
</build>
271359
</project>

pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,24 @@
1717
<module>test-clients</module>
1818
<module>library</module>
1919
</modules>
20+
21+
<build>
22+
<plugins>
23+
<plugin>
24+
<!-- https://central.sonatype.org/publish/publish-portal-maven/ -->
25+
<groupId>org.sonatype.central</groupId>
26+
<artifactId>central-publishing-maven-plugin</artifactId>
27+
<version>0.10.0</version>
28+
<extensions>true</extensions>
29+
<configuration>
30+
<autoPublish>false</autoPublish>
31+
<publishingServerId>central</publishingServerId>
32+
<excludeArtifacts>
33+
<excludeArtifact>oauth2-client-java-root</excludeArtifact>
34+
<excludeArtifact>oauth2-client-java-test-clients</excludeArtifact>
35+
</excludeArtifacts>
36+
</configuration>
37+
</plugin>
38+
</plugins>
39+
</build>
2040
</project>

0 commit comments

Comments
 (0)