Skip to content

Commit 9d999cb

Browse files
authored
Merge pull request SkillPanel#158 from spannm/build/pom-improvements
Refactor Maven configuration and modernize build pipeline
2 parents 75f7cb4 + 7e9cc2f commit 9d999cb

1 file changed

Lines changed: 169 additions & 29 deletions

File tree

pom.xml

Lines changed: 169 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<name>jFairy</name>
1010
<description>Java fake data generator</description>
1111
<url>https://github.com/Devskiller/jfairy</url>
12+
<inceptionYear>2013</inceptionYear>
1213

1314
<licenses>
1415
<license>
@@ -74,89 +75,130 @@
7475

7576
<properties>
7677
<revision>0.8.3-SNAPSHOT</revision>
77-
<maven.compiler.source>17</maven.compiler.source>
78-
<maven.compiler.target>17</maven.compiler.target>
78+
79+
<javaVersion>17</javaVersion>
80+
<maven.compiler.source>${javaVersion}</maven.compiler.source>
81+
<maven.compiler.target>${javaVersion}</maven.compiler.target>
82+
7983
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8084
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
85+
86+
<maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss z</maven.build.timestamp.format>
87+
88+
<!-- Dependency versions (ordered by usage) -->
89+
<dep.snakeyaml-engine.version>2.3</dep.snakeyaml-engine.version>
90+
<dep.jspecify.version>1.0.0</dep.jspecify.version>
91+
<dep.slf4j.version>2.0.16</dep.slf4j.version>
92+
<dep.iban4j.version>3.2.3-RELEASE</dep.iban4j.version>
93+
<dep.commons-validator.version>1.7</dep.commons-validator.version>
94+
<dep.logback.version>1.5.16</dep.logback.version>
95+
<dep.spock.version>2.4-groovy-4.0</dep.spock.version>
96+
<dep.groovy.version>4.0.24</dep.groovy.version>
97+
<dep.byte-buddy.version>1.15.11</dep.byte-buddy.version>
98+
<dep.objenesis.version>3.4</dep.objenesis.version>
99+
<dep.junit-jupiter.version>5.14.3</dep.junit-jupiter.version>
100+
101+
<!-- Plugin versions (ordered alphabetically) -->
102+
<dep.plugin.build-helper.version>3.6.1</dep.plugin.build-helper.version>
103+
<dep.plugin.central-publishing.version>0.10.0</dep.plugin.central-publishing.version>
104+
<dep.plugin.checkstyle.version>3.6.0</dep.plugin.checkstyle.version>
105+
<dep.plugin.compiler.version>3.15.0</dep.plugin.compiler.version>
106+
<dep.plugin.coveralls.version>4.3.0</dep.plugin.coveralls.version>
107+
<dep.plugin.deploy.version>3.1.4</dep.plugin.deploy.version>
108+
<dep.plugin.enforcer.version>3.6.2</dep.plugin.enforcer.version>
109+
<dep.plugin.error-prone.version>2.39.0</dep.plugin.error-prone.version>
110+
<dep.plugin.flatten.version>1.7.3</dep.plugin.flatten.version>
111+
<dep.plugin.gmavenplus.version>4.3.1</dep.plugin.gmavenplus.version>
112+
<dep.plugin.gpg.version>3.2.8</dep.plugin.gpg.version>
113+
<dep.plugin.jacoco.version>0.8.14</dep.plugin.jacoco.version>
114+
<dep.plugin.javadoc.version>3.12.0</dep.plugin.javadoc.version>
115+
<dep.plugin.jar.version>3.5.0</dep.plugin.jar.version>
116+
<dep.plugin.release.version>3.3.1</dep.plugin.release.version>
117+
<dep.plugin.resources.version>3.5.0</dep.plugin.resources.version>
118+
<dep.plugin.source.version>3.4.0</dep.plugin.source.version>
119+
<dep.plugin.surefire.version>3.5.5</dep.plugin.surefire.version>
120+
<dep.plugin.versions.version>2.21.0</dep.plugin.versions.version>
81121
</properties>
82122

83123
<dependencies>
84124
<dependency>
85125
<groupId>org.snakeyaml</groupId>
86126
<artifactId>snakeyaml-engine</artifactId>
87-
<version>2.3</version>
127+
<version>${dep.snakeyaml-engine.version}</version>
88128
</dependency>
89129
<dependency>
90130
<groupId>org.jspecify</groupId>
91131
<artifactId>jspecify</artifactId>
92-
<version>1.0.0</version>
132+
<version>${dep.jspecify.version}</version>
93133
</dependency>
94134
<dependency>
95135
<groupId>org.slf4j</groupId>
96136
<artifactId>slf4j-api</artifactId>
97-
<version>2.0.16</version>
137+
<version>${dep.slf4j.version}</version>
98138
</dependency>
99139
<dependency>
100140
<groupId>org.iban4j</groupId>
101141
<artifactId>iban4j</artifactId>
102-
<version>3.2.3-RELEASE</version>
142+
<version>${dep.iban4j.version}</version>
103143
</dependency>
104144
<dependency>
105145
<groupId>commons-validator</groupId>
106146
<artifactId>commons-validator</artifactId>
107-
<version>1.7</version>
147+
<version>${dep.commons-validator.version}</version>
108148
<scope>test</scope>
109149
</dependency>
110150
<dependency>
111151
<groupId>ch.qos.logback</groupId>
112152
<artifactId>logback-classic</artifactId>
113-
<version>1.5.16</version>
153+
<version>${dep.logback.version}</version>
114154
<scope>test</scope>
115155
</dependency>
116156
<dependency>
117157
<groupId>org.spockframework</groupId>
118158
<artifactId>spock-core</artifactId>
119-
<version>2.4-groovy-4.0</version>
159+
<version>${dep.spock.version}</version>
120160
<scope>test</scope>
121161
</dependency>
122162
<dependency>
123163
<groupId>org.apache.groovy</groupId>
124164
<artifactId>groovy</artifactId>
125-
<version>4.0.24</version>
165+
<version>${dep.groovy.version}</version>
126166
<scope>test</scope>
127167
</dependency>
128168
<dependency>
129169
<groupId>net.bytebuddy</groupId>
130170
<artifactId>byte-buddy</artifactId>
131-
<version>1.15.11</version>
171+
<version>${dep.byte-buddy.version}</version>
132172
<scope>test</scope>
133173
</dependency>
134174
<dependency>
135175
<groupId>org.objenesis</groupId>
136176
<artifactId>objenesis</artifactId>
137-
<version>3.4</version>
177+
<version>${dep.objenesis.version}</version>
138178
<scope>test</scope>
139179
</dependency>
140180
<dependency>
141181
<groupId>org.junit.jupiter</groupId>
142182
<artifactId>junit-jupiter</artifactId>
143-
<version>5.14.3</version>
183+
<version>${dep.junit-jupiter.version}</version>
144184
<scope>test</scope>
145185
</dependency>
146186
</dependencies>
147187

148-
149188
<build>
189+
190+
<defaultGoal>clean verify</defaultGoal>
191+
150192
<plugins>
151193
<plugin>
152194
<groupId>org.apache.maven.plugins</groupId>
153195
<artifactId>maven-resources-plugin</artifactId>
154-
<version>3.3.1</version>
196+
<version>${dep.plugin.resources.version}</version>
155197
</plugin>
156198
<plugin>
157199
<groupId>org.codehaus.mojo</groupId>
158200
<artifactId>build-helper-maven-plugin</artifactId>
159-
<version>3.6.1</version>
201+
<version>${dep.plugin.build-helper.version}</version>
160202
<executions>
161203
<execution>
162204
<id>add-test-source</id>
@@ -175,7 +217,7 @@
175217
<plugin>
176218
<groupId>org.apache.maven.plugins</groupId>
177219
<artifactId>maven-compiler-plugin</artifactId>
178-
<version>3.13.0</version>
220+
<version>${dep.plugin.compiler.version}</version>
179221
<configuration>
180222
<fork>true</fork>
181223
<compilerArgs>
@@ -198,15 +240,15 @@
198240
<path>
199241
<groupId>com.google.errorprone</groupId>
200242
<artifactId>error_prone_core</artifactId>
201-
<version>2.39.0</version>
243+
<version>${dep.plugin.error-prone.version}</version>
202244
</path>
203245
</annotationProcessorPaths>
204246
</configuration>
205247
</plugin>
206248
<plugin>
207249
<groupId>org.codehaus.gmavenplus</groupId>
208250
<artifactId>gmavenplus-plugin</artifactId>
209-
<version>4.2.0</version>
251+
<version>${dep.plugin.gmavenplus.version}</version>
210252
<executions>
211253
<execution>
212254
<goals>
@@ -225,10 +267,49 @@
225267
</testSources>
226268
</configuration>
227269
</plugin>
270+
271+
<plugin>
272+
<groupId>org.apache.maven.plugins</groupId>
273+
<artifactId>maven-enforcer-plugin</artifactId>
274+
<version>${dep.plugin.enforcer.version}</version>
275+
<configuration>
276+
<rules>
277+
278+
<requireMavenVersion>
279+
<version>[3.9.0,)</version>
280+
</requireMavenVersion>
281+
<requireJavaVersion>
282+
<version>[${javaVersion},)</version>
283+
</requireJavaVersion>
284+
285+
<requirePluginVersions>
286+
<message>Please always define Maven plugin versions</message>
287+
<banTimestamps>true</banTimestamps>
288+
289+
<unCheckedPluginList>
290+
org.apache.maven.plugins:maven-clean-plugin,
291+
org.apache.maven.plugins:maven-dependency-plugin,
292+
org.apache.maven.plugins:maven-install-plugin,
293+
org.apache.maven.plugins:maven-site-plugin
294+
</unCheckedPluginList>
295+
</requirePluginVersions>
296+
</rules>
297+
</configuration>
298+
<executions>
299+
<execution>
300+
<id>default-enforce</id>
301+
<goals>
302+
<goal>enforce</goal>
303+
</goals>
304+
<phase>validate</phase>
305+
</execution>
306+
</executions>
307+
</plugin>
308+
228309
<plugin>
229310
<groupId>org.apache.maven.plugins</groupId>
230311
<artifactId>maven-checkstyle-plugin</artifactId>
231-
<version>3.6.0</version>
312+
<version>${dep.plugin.checkstyle.version}</version>
232313
<configuration>
233314
<configLocation>google_checks.xml</configLocation>
234315
<consoleOutput>true</consoleOutput>
@@ -248,8 +329,9 @@
248329
</executions>
249330
</plugin>
250331
<plugin>
332+
<groupId>org.apache.maven.plugins</groupId>
251333
<artifactId>maven-surefire-plugin</artifactId>
252-
<version>3.5.5</version>
334+
<version>${dep.plugin.surefire.version}</version>
253335
<configuration>
254336
<includes>
255337
<include>**/*Spec.java</include>
@@ -260,12 +342,12 @@
260342
<plugin>
261343
<groupId>org.eluder.coveralls</groupId>
262344
<artifactId>coveralls-maven-plugin</artifactId>
263-
<version>4.3.0</version>
345+
<version>${dep.plugin.coveralls.version}</version>
264346
</plugin>
265347
<plugin>
266348
<groupId>org.jacoco</groupId>
267349
<artifactId>jacoco-maven-plugin</artifactId>
268-
<version>0.8.13</version>
350+
<version>${dep.plugin.jacoco.version}</version>
269351
<executions>
270352
<execution>
271353
<id>prepare-agent</id>
@@ -278,7 +360,7 @@
278360
<plugin>
279361
<groupId>org.codehaus.mojo</groupId>
280362
<artifactId>flatten-maven-plugin</artifactId>
281-
<version>1.7.0</version>
363+
<version>${dep.plugin.flatten.version}</version>
282364
<configuration>
283365
<outputDirectory>${project.build.directory}</outputDirectory>
284366
<updatePomFile>true</updatePomFile>
@@ -301,32 +383,90 @@
301383
</execution>
302384
</executions>
303385
</plugin>
386+
<plugin>
387+
<groupId>org.apache.maven.plugins</groupId>
388+
<artifactId>maven-jar-plugin</artifactId>
389+
<version>${dep.plugin.jar.version}</version>
390+
<configuration>
391+
<archive>
392+
<addMavenDescriptor>false</addMavenDescriptor>
393+
<compress>true</compress>
394+
<index>false</index>
395+
<manifest>
396+
<addClasspath>false</addClasspath>
397+
<addDefaultEntries>true</addDefaultEntries>
398+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> <!-- Implementation-Title/Version/Vendor -->
399+
<addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
400+
<addBuildEnvironmentEntries>true</addBuildEnvironmentEntries> <!-- Build-Jdk, Build-Os, Build-Tool -->
401+
</manifest>
402+
403+
<manifestEntries>
404+
<Build-Time>${maven.build.timestamp}</Build-Time>
405+
<Project-Url>${project.url}</Project-Url>
406+
<Project-Inception-Year>${project.inceptionYear}</Project-Inception-Year>
407+
</manifestEntries>
408+
</archive>
409+
</configuration>
410+
</plugin>
304411
<plugin>
305412
<groupId>org.apache.maven.plugins</groupId>
306413
<artifactId>maven-deploy-plugin</artifactId>
414+
<version>${dep.plugin.deploy.version}</version>
307415
<configuration>
308416
<skip>true</skip>
309417
</configuration>
310418
</plugin>
311419
<plugin>
312420
<groupId>org.apache.maven.plugins</groupId>
313421
<artifactId>maven-release-plugin</artifactId>
422+
<version>${dep.plugin.release.version}</version>
314423
<configuration>
315424
<releaseProfiles>release</releaseProfiles>
316425
</configuration>
317426
</plugin>
427+
<plugin>
428+
<groupId>org.codehaus.mojo</groupId>
429+
<artifactId>versions-maven-plugin</artifactId>
430+
<version>${dep.plugin.versions.version}</version>
431+
<configuration>
432+
<ruleSet>
433+
<ignoreVersions>
434+
<ignoreVersion>
435+
<type>regex</type>
436+
<version>.*(?i)(alpha|beta|rc|cr|preview|milestone|[mb][0-9]+).*</version>
437+
</ignoreVersion>
438+
</ignoreVersions>
439+
</ruleSet>
440+
</configuration>
441+
</plugin>
318442
</plugins>
319443
</build>
320444

321445
<profiles>
446+
<profile>
447+
<id>fast</id>
448+
<!-- profile to skip time-consuming steps -->
449+
<activation>
450+
<activeByDefault>false</activeByDefault>
451+
</activation>
452+
<properties>
453+
<!-- skip _compiling_ the tests -->
454+
<maven.test.skip>true</maven.test.skip>
455+
<!-- skip execution of tests -->
456+
<skipTests>true</skipTests>
457+
458+
<maven.javadoc.skip>true</maven.javadoc.skip>
459+
</properties>
460+
</profile>
461+
322462
<profile>
323463
<id>release</id>
324464
<build>
325465
<plugins>
326466
<plugin>
327467
<groupId>org.apache.maven.plugins</groupId>
328468
<artifactId>maven-gpg-plugin</artifactId>
329-
<version>3.2.8</version>
469+
<version>${dep.plugin.gpg.version}</version>
330470
<executions>
331471
<execution>
332472
<id>sign-artifacts</id>
@@ -340,7 +480,7 @@
340480
<plugin>
341481
<groupId>org.apache.maven.plugins</groupId>
342482
<artifactId>maven-source-plugin</artifactId>
343-
<version>3.3.1</version>
483+
<version>${dep.plugin.source.version}</version>
344484
<executions>
345485
<execution>
346486
<id>attach-sources</id>
@@ -353,7 +493,7 @@
353493
<plugin>
354494
<groupId>org.apache.maven.plugins</groupId>
355495
<artifactId>maven-javadoc-plugin</artifactId>
356-
<version>3.12.0</version>
496+
<version>${dep.plugin.javadoc.version}</version>
357497
<configuration>
358498
<doclint>none</doclint>
359499
</configuration>
@@ -366,10 +506,10 @@
366506
</execution>
367507
</executions>
368508
</plugin>
369-
<plugin>
509+
<plugin>
370510
<groupId>org.sonatype.central</groupId>
371511
<artifactId>central-publishing-maven-plugin</artifactId>
372-
<version>0.10.0</version>
512+
<version>${dep.plugin.central-publishing.version}</version>
373513
<extensions>true</extensions>
374514
<executions>
375515
<execution>

0 commit comments

Comments
 (0)