Skip to content

Commit 6d257fa

Browse files
authored
Merge pull request #33 from SWAT-engineering/feat/release-on-maven-central
Preparing the project for deployment to maven central
2 parents 5e7da8e + f38f7b8 commit 6d257fa

File tree

5 files changed

+158
-37
lines changed

5 files changed

+158
-37
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ on:
33
push:
44
branches:
55
- main
6-
tags:
7-
- 'v[0-9]+.*'
86
pull_request:
97
branches:
108
- main

.github/workflows/release.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish package maven
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: MAVEN_USERNAME # env variable for username in deploy
16+
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
17+
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
18+
gpg-passphrase: GPG_PASSPHRASE
19+
20+
- name: Publish package
21+
run: mvn -B -P release deploy
22+
env:
23+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USER }}
24+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
25+
GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSPHRASE }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ hs_err_pid*
2424
replay_pid*
2525

2626
/target
27+
28+
# release plugin state files
29+
/pom.xml.releaseBackup
30+
/release.properties

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"editorconfig.editorconfig" // make sure basic editor configs align between developers
6+
]
7+
}

pom.xml

Lines changed: 122 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@
2727
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
2929
-->
30-
<project xmlns="http://maven.apache.org/POM/4.0.0"
31-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
30+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3231
<modelVersion>4.0.0</modelVersion>
3332

3433
<groupId>engineering.swat</groupId>
3534
<artifactId>java-watch</artifactId>
36-
<version>0.0.1-SNAPSHOT</version>
35+
<version>0.5.0-RC5-SNAPSHOT</version>
3736
<packaging>jar</packaging>
37+
38+
<name>${project.groupId}:${project.artifactId}</name>
39+
<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>
40+
<url>https://github.com/SWAT-engineering/java-watch</url>
41+
3842
<licenses>
3943
<license>
4044
<name>BSD-2-Clause</name>
@@ -43,6 +47,28 @@
4347
</license>
4448
</licenses>
4549

50+
<developers>
51+
<developer>
52+
<name>Davy Landman</name>
53+
<email>[email protected]</email>
54+
<organization>swat.engineering</organization>
55+
<organizationUrl>https://www.swat.engineering</organizationUrl>
56+
</developer>
57+
<developer>
58+
<name>Sung-Shik Jongmans</name>
59+
<email>[email protected]</email>
60+
<organization>swat.engineering</organization>
61+
<organizationUrl>https://www.swat.engineering</organizationUrl>
62+
</developer>
63+
</developers>
64+
65+
<scm>
66+
<connection>scm:git:git://github.com/SWAT-engineering/java-watch.git</connection>
67+
<developerConnection>scm:git:ssh://[email protected]/SWAT-engineering/java-watch.git</developerConnection>
68+
<url>https://github.com/SWAT-engineering/java-watch/tree/main/</url>
69+
<tag>v0.5.0-RC3</tag>
70+
</scm>
71+
4672
<properties>
4773
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4874
<checkerframework.version>3.42.0</checkerframework.version>
@@ -54,52 +80,34 @@
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>
60-
<version>3.10.1</version>
86+
<version>3.14.0</version>
6187
<configuration>
6288
<release>11</release>
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 />
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>
97-
<version>2.22.2</version>
105+
<version>3.5.3</version>
98106
</plugin>
99-
<plugin>
107+
<plugin> <!-- code coverage -->
100108
<groupId>org.jacoco</groupId>
101109
<artifactId>jacoco-maven-plugin</artifactId>
102-
<version>0.8.8</version>
110+
<version>0.8.13</version>
103111
<executions>
104112
<execution>
105113
<goals>
@@ -115,11 +123,11 @@
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 -->
122-
<version>4.6</version>
130+
<version>5.0.0</version>
123131
<configuration>
124132
<licenseSets>
125133
<licenseSet>
@@ -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>
@@ -157,6 +165,26 @@
157165
</execution>
158166
</executions>
159167
</plugin>
168+
<plugin> <!-- use a new version of maven -->
169+
<groupId>org.apache.maven.plugins</groupId>
170+
<artifactId>maven-enforcer-plugin</artifactId>
171+
<version>3.5.0</version>
172+
<executions>
173+
<execution>
174+
<id>enforce-maven</id>
175+
<goals>
176+
<goal>enforce</goal>
177+
</goals>
178+
<configuration>
179+
<rules>
180+
<requireMavenVersion>
181+
<version>(3.9,)</version>
182+
</requireMavenVersion>
183+
</rules>
184+
</configuration>
185+
</execution>
186+
</executions>
187+
</plugin>
160188
</plugins>
161189
</build>
162190

@@ -197,6 +225,64 @@
197225
</dependencies>
198226

199227
<profiles>
228+
<profile> <!-- releasing to maven central -->
229+
<id>release</id>
230+
<build>
231+
<plugins>
232+
<plugin><!-- uploading to maven central-->
233+
<groupId>org.sonatype.central</groupId>
234+
<artifactId>central-publishing-maven-plugin</artifactId>
235+
<version>0.7.0</version>
236+
<extensions>true</extensions>
237+
<configuration>
238+
<publishingServerId>central</publishingServerId>
239+
</configuration>
240+
</plugin>
241+
<plugin> <!-- sign jar for maven central-->
242+
<groupId>org.apache.maven.plugins</groupId>
243+
<artifactId>maven-gpg-plugin</artifactId>
244+
<version>3.2.7</version>
245+
<executions>
246+
<execution>
247+
<id>sign-artifacts</id>
248+
<phase>verify</phase>
249+
<goals>
250+
<goal>sign</goal>
251+
</goals>
252+
</execution>
253+
</executions>
254+
</plugin>
255+
<plugin> <!-- generate java-doc -->
256+
<groupId>org.apache.maven.plugins</groupId>
257+
<artifactId>maven-javadoc-plugin</artifactId>
258+
<version>3.11.2</version>
259+
<executions>
260+
<execution>
261+
<id>attach-javadocs</id>
262+
<goals>
263+
<goal>jar</goal>
264+
</goals>
265+
</execution>
266+
</executions>
267+
</plugin>
268+
<plugin> <!-- generate sources jar -->
269+
<groupId>org.apache.maven.plugins</groupId>
270+
<artifactId>maven-source-plugin</artifactId>
271+
<version>3.3.1</version>
272+
<executions>
273+
<execution>
274+
<id>attach-sources</id>
275+
<goals>
276+
<goal>jar-no-fork</goal>
277+
</goals>
278+
</execution>
279+
</executions>
280+
</plugin>
281+
</plugins>
282+
</build>
283+
</profile>
284+
285+
200286
<profile> <!-- run with: mvn clean compile -P checker-framework -->
201287
<id>checker-framework</id>
202288
<build>
@@ -205,6 +291,7 @@
205291
<!-- This plugin will set properties values using dependency information -->
206292
<groupId>org.apache.maven.plugins</groupId>
207293
<artifactId>maven-dependency-plugin</artifactId>
294+
<version>3.8.1</version>
208295
<executions>
209296
<execution>
210297
<goals>
@@ -216,7 +303,7 @@
216303
<plugin>
217304
<groupId>org.apache.maven.plugins</groupId>
218305
<artifactId>maven-compiler-plugin</artifactId>
219-
<version>3.10.1</version>
306+
<version>3.14.0</version>
220307
<configuration>
221308
<fork>true</fork>
222309
<release>11</release>

0 commit comments

Comments
 (0)