Skip to content

Commit f720f29

Browse files
committed
Configure plugins for publishing to Maven Central
1 parent 46a9b8d commit f720f29

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

pom.xml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@
6262
<!-- Maven plugins -->
6363
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
6464
<ktfmt.version>0.43</ktfmt.version>
65+
<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
6566
<maven-enforcer.version>3.4.1</maven-enforcer.version>
67+
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
68+
<dokka-maven-plugin.version>1.9.20</dokka-maven-plugin.version>
69+
<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
70+
<central-publishing-maven-plugin.version>0.6.0</central-publishing-maven-plugin.version>
6671
</properties>
6772

6873
<dependencyManagement>
@@ -129,6 +134,7 @@
129134
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
130135

131136
<plugins>
137+
<!-- Kotlin compilation and kotlinx.serialization codegen -->
132138
<plugin>
133139
<groupId>org.jetbrains.kotlin</groupId>
134140
<artifactId>kotlin-maven-plugin</artifactId>
@@ -164,6 +170,13 @@
164170
</executions>
165171
</plugin>
166172

173+
<!-- Testing -->
174+
<plugin>
175+
<groupId>org.apache.maven.plugins</groupId>
176+
<artifactId>maven-surefire-plugin</artifactId>
177+
<version>${maven-surefire-plugin.version}</version>
178+
</plugin>
179+
167180
<!-- Formatting with ktfmt -->
168181
<plugin>
169182
<groupId>com.diffplug.spotless</groupId>
@@ -210,6 +223,68 @@
210223
</execution>
211224
</executions>
212225
</plugin>
226+
227+
<!-- Generates source file JARs, required for publishing to Maven Central -->
228+
<plugin>
229+
<groupId>org.apache.maven.plugins</groupId>
230+
<artifactId>maven-source-plugin</artifactId>
231+
<version>${maven-source-plugin.version}</version>
232+
<executions>
233+
<execution>
234+
<id>attach-sources</id>
235+
<goals>
236+
<goal>jar-no-fork</goal>
237+
</goals>
238+
</execution>
239+
</executions>
240+
</plugin>
241+
242+
<!-- Generates Javadoc JAR, required for publishing to Maven Central -->
243+
<plugin>
244+
<groupId>org.jetbrains.dokka</groupId>
245+
<artifactId>dokka-maven-plugin</artifactId>
246+
<version>${dokka-maven-plugin.version}</version>
247+
<executions>
248+
<execution>
249+
<phase>prepare-package</phase>
250+
<goals>
251+
<goal>javadocJar</goal>
252+
</goals>
253+
</execution>
254+
</executions>
255+
</plugin>
256+
257+
<!-- Signs built artifacts with GPG, required for publishing to Maven Central -->
258+
<plugin>
259+
<groupId>org.apache.maven.plugins</groupId>
260+
<artifactId>maven-gpg-plugin</artifactId>
261+
<version>${maven-gpg-plugin.version}</version>
262+
<executions>
263+
<execution>
264+
<id>sign-artifacts</id>
265+
<phase>verify</phase>
266+
<goals>
267+
<goal>sign</goal>
268+
</goals>
269+
<configuration>
270+
<bestPractices>true</bestPractices>
271+
<keyname>${gpg.keyname}</keyname>
272+
</configuration>
273+
</execution>
274+
</executions>
275+
</plugin>
276+
277+
<!-- Publishes to Maven Central -->
278+
<plugin>
279+
<groupId>org.sonatype.central</groupId>
280+
<artifactId>central-publishing-maven-plugin</artifactId>
281+
<version>${central-publishing-maven-plugin.version}</version>
282+
<extensions>true</extensions>
283+
<configuration>
284+
<publishingServerId>central</publishingServerId>
285+
<deploymentName>${artifactId} v${version}</deploymentName>
286+
</configuration>
287+
</plugin>
213288
</plugins>
214289
</build>
215290
</project>

0 commit comments

Comments
 (0)