Skip to content

Commit 64eb7fa

Browse files
committed
Preparing the project for deployment to maven central
1 parent 5e7da8e commit 64eb7fa

File tree

2 files changed

+114
-27
lines changed

2 files changed

+114
-27
lines changed

.github/workflows/release.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-java@v4
11+
with:
12+
java-version: '11'
13+
distribution: 'temurin'
14+
server-id: central
15+
server-username: ${{ secrets.MAVEN_CENTRAL_USER }}
16+
server-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
17+
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
18+
gpg-passphrase: ${{ secrets.GPG_SIGNING_KEY_PASSPHRASE }}
19+
20+
- name: Publish package
21+
run: mvn --batch-mode deploy

pom.xml

Lines changed: 93 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
<artifactId>java-watch</artifactId>
3636
<version>0.0.1-SNAPSHOT</version>
3737
<packaging>jar</packaging>
38+
39+
<name>${project.groupId}:${project.artifactId}</name>
40+
<description>A java file watcher that works across platforms and supports recursion, single file watches, and tries to make sure no events are missed. Where possible it uses Java's NIO WatchService.</description>
41+
<url>https://github.com/SWAT-engineering/java-watch</url>
42+
3843
<licenses>
3944
<license>
4045
<name>BSD-2-Clause</name>
@@ -43,6 +48,27 @@
4348
</license>
4449
</licenses>
4550

51+
<developers>
52+
<developer>
53+
<name>Davy Landman</name>
54+
<email>[email protected]</email>
55+
<organization>swat.engineering</organization>
56+
<organizationUrl>https://www.swat.engineering</organizationUrl>
57+
</developer>
58+
<developer>
59+
<name>Sung-Shik Jongmans</name>
60+
<email>[email protected]</email>
61+
<organization>swat.engineering</organization>
62+
<organizationUrl>https://www.swat.engineering</organizationUrl>
63+
</developer>
64+
</developers>
65+
66+
<scm>
67+
<connection>scm:git:git://github.com/SWAT-engineering/java-watch.git</connection>
68+
<developerConnection>scm:git:ssh://github.com:SWAT-engineering/java-watch.git</developerConnection>
69+
<url>https://github.com/SWAT-engineering/java-watch/tree/main/</url>
70+
</scm>
71+
4672
<properties>
4773
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4874
<checkerframework.version>3.42.0</checkerframework.version>
@@ -54,7 +80,7 @@
5480

5581
<build>
5682
<plugins>
57-
<plugin>
83+
<plugin> <!-- configure java compiler -->
5884
<groupId>org.apache.maven.plugins</groupId>
5985
<artifactId>maven-compiler-plugin</artifactId>
6086
<version>3.10.1</version>
@@ -63,40 +89,22 @@
6389
<compilerArgument>-parameters</compilerArgument>
6490
</configuration>
6591
</plugin>
66-
<plugin>
67-
<groupId>org.apache.maven.plugins</groupId>
68-
<artifactId>maven-source-plugin</artifactId>
69-
<version>3.2.1</version>
70-
<executions>
71-
<execution>
72-
<id>attach-sources</id>
73-
<goals>
74-
<goal>jar</goal>
75-
</goals>
76-
</execution>
77-
</executions>
78-
</plugin>
79-
<plugin>
92+
<plugin> <!-- automate release commits -->
8093
<groupId>org.apache.maven.plugins</groupId>
8194
<artifactId>maven-release-plugin</artifactId>
95+
<version>3.1.1</version>
8296
<configuration>
8397
<tagNameFormat>v@{project.version}</tagNameFormat>
98+
<!-- do not use the build in release profile, we invoke it later -->
99+
<releaseProfiles></releaseProfiles>
84100
</configuration>
85101
</plugin>
86-
<plugin>
87-
<groupId>org.apache.maven.plugins</groupId>
88-
<artifactId>maven-javadoc-plugin</artifactId>
89-
<version>3.4.0</version>
90-
<configuration>
91-
<additionalparam>-Xdoclint:none</additionalparam>
92-
</configuration>
93-
</plugin>
94-
<plugin>
102+
<plugin> <!-- unit test integration -->
95103
<groupId>org.apache.maven.plugins</groupId>
96104
<artifactId>maven-surefire-plugin</artifactId>
97105
<version>2.22.2</version>
98106
</plugin>
99-
<plugin>
107+
<plugin> <!-- code coverage -->
100108
<groupId>org.jacoco</groupId>
101109
<artifactId>jacoco-maven-plugin</artifactId>
102110
<version>0.8.8</version>
@@ -115,7 +123,7 @@
115123
</execution>
116124
</executions>
117125
</plugin>
118-
<plugin>
126+
<plugin> <!-- enforce license headers -->
119127
<groupId>com.mycila</groupId>
120128
<artifactId>license-maven-plugin</artifactId>
121129
<!-- mvn license:format adds/updates all license headers -->
@@ -142,7 +150,7 @@
142150
</execution>
143151
</executions>
144152
</plugin>
145-
<plugin>
153+
<plugin> <!-- enforce editor config on the files -->
146154
<groupId>org.ec4j.maven</groupId>
147155
<artifactId>editorconfig-maven-plugin</artifactId>
148156
<version>0.1.3</version>
@@ -197,6 +205,64 @@
197205
</dependencies>
198206

199207
<profiles>
208+
<profile> <!-- releasing to maven central -->
209+
<id>release</id>
210+
<build>
211+
<plugins>
212+
<plugin><!-- uploading to maven central-->
213+
<groupId>org.sonatype.central</groupId>
214+
<artifactId>central-publishing-maven-plugin</artifactId>
215+
<version>0.7.0</version>
216+
<extensions>true</extensions>
217+
<configuration>
218+
<publishingServerId>central</publishingServerId>
219+
</configuration>
220+
</plugin>
221+
<plugin> <!-- sign jar for maven central-->
222+
<groupId>org.apache.maven.plugins</groupId>
223+
<artifactId>maven-gpg-plugin</artifactId>
224+
<version>1.5</version>
225+
<executions>
226+
<execution>
227+
<id>sign-artifacts</id>
228+
<phase>verify</phase>
229+
<goals>
230+
<goal>sign</goal>
231+
</goals>
232+
</execution>
233+
</executions>
234+
</plugin>
235+
<plugin> <!-- generate java-doc -->
236+
<groupId>org.apache.maven.plugins</groupId>
237+
<artifactId>maven-javadoc-plugin</artifactId>
238+
<version>3.4.0</version>
239+
<executions>
240+
<execution>
241+
<id>attach-javadocs</id>
242+
<goals>
243+
<goal>jar</goal>
244+
</goals>
245+
</execution>
246+
</executions>
247+
</plugin>
248+
<plugin> <!-- generate sources jar -->
249+
<groupId>org.apache.maven.plugins</groupId>
250+
<artifactId>maven-source-plugin</artifactId>
251+
<version>3.2.1</version>
252+
<executions>
253+
<execution>
254+
<id>attach-sources</id>
255+
<goals>
256+
<goal>jar-no-fork</goal>
257+
</goals>
258+
</execution>
259+
</executions>
260+
</plugin>
261+
</plugins>
262+
</build>
263+
</profile>
264+
265+
200266
<profile> <!-- run with: mvn clean compile -P checker-framework -->
201267
<id>checker-framework</id>
202268
<build>

0 commit comments

Comments
 (0)