|
37 | 37 |
|
38 | 38 | <properties> |
39 | 39 | <!-- Maven Build Properties --> |
40 | | - <maven.compiler.source>1.8</maven.compiler.source> |
41 | | - <maven.compiler.target>1.8</maven.compiler.target> |
| 40 | + <maven.compiler.release>8</maven.compiler.release> |
42 | 41 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
43 | 42 | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
44 | 43 | <maven.javadoc.failOnError>false</maven.javadoc.failOnError> |
45 | 44 |
|
| 45 | + <!-- Build requirements --> |
| 46 | + <!-- |
| 47 | + ~ Minimum JDK version required to build the library: |
| 48 | + ~ Maven plugins MUST be compatible with this version. |
| 49 | + --> |
| 50 | + <min.jdk.version>17</min.jdk.version> |
| 51 | + <!-- |
| 52 | + ~ Upper bound for the JDK version in an official release: |
| 53 | + ~ Builds MUST use a JDK version between `min.jdk.version` (inclusive) and `max.jdk.version` (exclusive) |
| 54 | + ~ to be reproducible. |
| 55 | + --> |
| 56 | + <max.jdk.version>18</max.jdk.version> |
| 57 | + |
46 | 58 | <!-- Maven Plugin Versions --> |
| 59 | + <maven.clean.plugin.version>2.5</maven.clean.plugin.version> |
47 | 60 | <maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version> |
| 61 | + <maven.deploy.plugin.version>2.7</maven.deploy.plugin.version> |
| 62 | + <maven.enforcer.plugin.version>3.4.1</maven.enforcer.plugin.version> |
| 63 | + <maven.install.plugin.version>2.4</maven.install.plugin.version> |
48 | 64 | <maven.jar.plugin.version>3.3.0</maven.jar.plugin.version> |
49 | 65 | <maven.javadoc.plugin.version>3.6.3</maven.javadoc.plugin.version> |
50 | 66 | <maven.release.plugin.version>3.0.1</maven.release.plugin.version> |
| 67 | + <maven.resources.plugin.version>2.6</maven.resources.plugin.version> |
| 68 | + <maven.site.plugin.version>3.3</maven.site.plugin.version> |
51 | 69 | <maven.source.plugin.version>3.3.0</maven.source.plugin.version> |
| 70 | + <maven.surefire.plugin.version>3.5.2</maven.surefire.plugin.version> |
52 | 71 | <!-- Maven build plugins for quality checks --> |
53 | | - <plexus.compiler.javac.errorprone.version>2.8.5</plexus.compiler.javac.errorprone.version> |
54 | | - <error.prone.core.version>2.3.2</error.prone.core.version> |
| 72 | + <error.prone.core.version>2.36.0</error.prone.core.version> |
55 | 73 | <jacoco.maven.plugin.version>0.8.11</jacoco.maven.plugin.version> |
56 | 74 | <spotbugs.maven.plugin.version>4.8.3.1</spotbugs.maven.plugin.version> |
57 | 75 | <com.github.spotbugs.version>4.8.3</com.github.spotbugs.version> |
|
116 | 134 | <build> |
117 | 135 | <pluginManagement> |
118 | 136 | <plugins> |
| 137 | + <plugin> |
| 138 | + <groupId>org.apache.maven.plugins</groupId> |
| 139 | + <artifactId>maven-clean-plugin</artifactId> |
| 140 | + <version>${maven.clean.plugin.version}</version> |
| 141 | + </plugin> |
| 142 | + <plugin> |
| 143 | + <groupId>org.apache.maven.plugins</groupId> |
| 144 | + <artifactId>maven-compiler-plugin</artifactId> |
| 145 | + <version>${maven.compiler.plugin.version}</version> |
| 146 | + </plugin> |
| 147 | + <plugin> |
| 148 | + <groupId>org.apache.maven.plugins</groupId> |
| 149 | + <artifactId>maven-deploy-plugin</artifactId> |
| 150 | + <version>${maven.deploy.plugin.version}</version> |
| 151 | + </plugin> |
| 152 | + <plugin> |
| 153 | + <groupId>org.apache.maven.plugins</groupId> |
| 154 | + <artifactId>maven-enforcer-plugin</artifactId> |
| 155 | + <version>${maven.enforcer.plugin.version}</version> |
| 156 | + </plugin> |
| 157 | + <plugin> |
| 158 | + <groupId>org.apache.maven.plugins</groupId> |
| 159 | + <artifactId>maven-install-plugin</artifactId> |
| 160 | + <version>${maven.install.plugin.version}</version> |
| 161 | + </plugin> |
119 | 162 | <plugin> |
120 | 163 | <groupId>org.apache.maven.plugins</groupId> |
121 | 164 | <artifactId>maven-jar-plugin</artifactId> |
|
128 | 171 | </plugin> |
129 | 172 | <plugin> |
130 | 173 | <groupId>org.apache.maven.plugins</groupId> |
131 | | - <artifactId>maven-compiler-plugin</artifactId> |
132 | | - <version>${maven.compiler.plugin.version}</version> |
133 | | - <configuration> |
134 | | - <compilerId>javac-with-errorprone</compilerId> |
135 | | - <forceJavacCompilerUse>true</forceJavacCompilerUse> |
136 | | - <showDeprecation>true</showDeprecation> |
137 | | - <compilerArgs> |
138 | | - <arg>-Xlint</arg> |
139 | | - </compilerArgs> |
140 | | - </configuration> |
141 | | - <dependencies> |
142 | | - <dependency> |
143 | | - <groupId>org.codehaus.plexus</groupId> |
144 | | - <artifactId>plexus-compiler-javac-errorprone</artifactId> |
145 | | - <version>${plexus.compiler.javac.errorprone.version}</version> |
146 | | - </dependency> |
147 | | - <!-- override plexus-compiler-javac-errorprone's dependency on Error Prone with the latest version --> |
148 | | - <dependency> |
149 | | - <groupId>com.google.errorprone</groupId> |
150 | | - <artifactId>error_prone_core</artifactId> |
151 | | - <version>${error.prone.core.version}</version> |
152 | | - </dependency> |
153 | | - </dependencies> |
| 174 | + <artifactId>maven-resources-plugin</artifactId> |
| 175 | + <version>${maven.resources.plugin.version}</version> |
| 176 | + </plugin> |
| 177 | + <plugin> |
| 178 | + <groupId>org.apache.maven.plugins</groupId> |
| 179 | + <artifactId>maven-site-plugin</artifactId> |
| 180 | + <version>${maven.site.plugin.version}</version> |
| 181 | + </plugin> |
| 182 | + <plugin> |
| 183 | + <groupId>org.apache.maven.plugins</groupId> |
| 184 | + <artifactId>maven-surefire-plugin</artifactId> |
| 185 | + <version>${maven.surefire.plugin.version}</version> |
154 | 186 | </plugin> |
155 | 187 | </plugins> |
156 | 188 | </pluginManagement> |
157 | 189 | <plugins> |
| 190 | + <plugin> |
| 191 | + <groupId>org.apache.maven.plugins</groupId> |
| 192 | + <artifactId>maven-enforcer-plugin</artifactId> |
| 193 | + <executions> |
| 194 | + <execution> |
| 195 | + <id>enforce-build-environment</id> |
| 196 | + <goals> |
| 197 | + <goal>enforce</goal> |
| 198 | + </goals> |
| 199 | + <configuration> |
| 200 | + <rules> |
| 201 | + <requireJavaVersion> |
| 202 | + <display>true</display> |
| 203 | + <version>[${min.jdk.version},)</version> |
| 204 | + <message>To build this library you need JDK ${min.jdk.version} or higher.</message> |
| 205 | + </requireJavaVersion> |
| 206 | + <requirePluginVersions/> |
| 207 | + </rules> |
| 208 | + </configuration> |
| 209 | + </execution> |
| 210 | + </executions> |
| 211 | + </plugin> |
| 212 | + <plugin> |
| 213 | + <groupId>org.apache.maven.plugins</groupId> |
| 214 | + <artifactId>maven-compiler-plugin</artifactId> |
| 215 | + <configuration> |
| 216 | + <release>${maven.compiler.release}</release> |
| 217 | + <showDeprecation>true</showDeprecation> |
| 218 | + <compilerArgs> |
| 219 | + <arg>-Xlint:all</arg> |
| 220 | + <!-- Error Prone plugin --> |
| 221 | + <arg>-XDcompilePolicy=simple</arg> |
| 222 | + <arg>--should-stop=ifError=FLOW</arg> |
| 223 | + <arg>-Xplugin:ErrorProne</arg> |
| 224 | + <!-- No annotation processors for now --> |
| 225 | + <arg>-proc:none</arg> |
| 226 | + </compilerArgs> |
| 227 | + <!-- |
| 228 | + ~ Due to the changes to annotation processor policy in JDK 23, all annotation processors |
| 229 | + ~ should be mentioned explicitly. |
| 230 | + ~ To add an annotation processor, add it to `annotationProcessors` below and remove |
| 231 | + ~ `-proc:none` above. |
| 232 | + ~ |
| 233 | + ~ See: https://inside.java/2024/06/18/quality-heads-up/ |
| 234 | + --> |
| 235 | + <annotationProcessors/> |
| 236 | + <annotationProcessorPaths> |
| 237 | + <path> |
| 238 | + <groupId>com.google.errorprone</groupId> |
| 239 | + <artifactId>error_prone_core</artifactId> |
| 240 | + <version>${error.prone.core.version}</version> |
| 241 | + </path> |
| 242 | + </annotationProcessorPaths> |
| 243 | + </configuration> |
| 244 | + </plugin> |
158 | 245 | <plugin> |
159 | 246 | <groupId>com.github.spotbugs</groupId> |
160 | 247 | <artifactId>spotbugs-maven-plugin</artifactId> |
|
250 | 337 | </build> |
251 | 338 |
|
252 | 339 | <profiles> |
| 340 | + |
| 341 | + <!-- |
| 342 | + ~ Profile to run tests using JRE 8. |
| 343 | + ~ |
| 344 | + ~ It activates if a toolchains configuration file is present. |
| 345 | + ~ See: https://maven.apache.org/guides/mini/guide-using-toolchains.html |
| 346 | + --> |
| 347 | + <profile> |
| 348 | + <id>java8-tests</id> |
| 349 | + <activation> |
| 350 | + <file> |
| 351 | + <exists>${user.home}/.m2/toolchains.xml</exists> |
| 352 | + </file> |
| 353 | + </activation> |
| 354 | + |
| 355 | + <build> |
| 356 | + <plugins> |
| 357 | + <plugin> |
| 358 | + <groupId>org.apache.maven.plugins</groupId> |
| 359 | + <artifactId>maven-surefire-plugin</artifactId> |
| 360 | + <executions> |
| 361 | + <execution> |
| 362 | + <id>default-test</id> |
| 363 | + <configuration> |
| 364 | + <jdkToolchain> |
| 365 | + <version>[1.8,9)</version> |
| 366 | + </jdkToolchain> |
| 367 | + </configuration> |
| 368 | + </execution> |
| 369 | + </executions> |
| 370 | + </plugin> |
| 371 | + </plugins> |
| 372 | + </build> |
| 373 | + </profile> |
| 374 | + |
253 | 375 | <profile> |
254 | 376 | <id>release</id> |
255 | 377 | <activation> |
|
260 | 382 | <plugin> |
261 | 383 | <groupId>org.apache.maven.plugins</groupId> |
262 | 384 | <artifactId>maven-enforcer-plugin</artifactId> |
263 | | - <version>3.4.1</version> |
264 | 385 | <executions> |
265 | 386 | <execution> |
266 | | - <id>enforce-java</id> |
267 | | - <goals> |
268 | | - <goal>enforce</goal> |
269 | | - </goals> |
| 387 | + <id>enforce-build-environment</id> |
270 | 388 | <configuration> |
271 | 389 | <rules> |
272 | 390 | <requireJavaVersion> |
273 | | - <version>1.8.0</version> |
| 391 | + <display>true</display> |
| 392 | + <version>[${min.jdk.version},${max.jdk.version})</version> |
| 393 | + <message>To release this library you need JDK ${min.jdk.version}.</message> |
274 | 394 | </requireJavaVersion> |
275 | 395 | </rules> |
276 | 396 | </configuration> |
|
0 commit comments