-
Notifications
You must be signed in to change notification settings - Fork 19
Bump build requirement to JDK 17 #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 17 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED | ||
| --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED | ||
| --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,21 +37,39 @@ | |
|
|
||
| <properties> | ||
| <!-- Maven Build Properties --> | ||
| <maven.compiler.source>1.8</maven.compiler.source> | ||
| <maven.compiler.target>1.8</maven.compiler.target> | ||
| <maven.compiler.release>8</maven.compiler.release> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
| <maven.javadoc.failOnError>false</maven.javadoc.failOnError> | ||
|
|
||
| <!-- Build requirements --> | ||
| <!-- | ||
| ~ Minimum JDK version required to build the library: | ||
| ~ Maven plugins MUST be compatible with this version. | ||
| --> | ||
| <min.jdk.version>17</min.jdk.version> | ||
| <!-- | ||
| ~ Upper bound for the JDK version in an official release: | ||
| ~ Builds MUST use a JDK version between `min.jdk.version` (inclusive) and `max.jdk.version` (exclusive) | ||
| ~ to be reproducible. | ||
| --> | ||
| <max.jdk.version>18</max.jdk.version> | ||
|
|
||
| <!-- Maven Plugin Versions --> | ||
| <maven.clean.plugin.version>2.5</maven.clean.plugin.version> | ||
| <maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version> | ||
| <maven.deploy.plugin.version>2.7</maven.deploy.plugin.version> | ||
| <maven.enforcer.plugin.version>3.4.1</maven.enforcer.plugin.version> | ||
| <maven.install.plugin.version>2.4</maven.install.plugin.version> | ||
| <maven.jar.plugin.version>3.3.0</maven.jar.plugin.version> | ||
| <maven.javadoc.plugin.version>3.6.3</maven.javadoc.plugin.version> | ||
| <maven.release.plugin.version>3.0.1</maven.release.plugin.version> | ||
| <maven.resources.plugin.version>2.6</maven.resources.plugin.version> | ||
| <maven.site.plugin.version>3.3</maven.site.plugin.version> | ||
| <maven.source.plugin.version>3.3.0</maven.source.plugin.version> | ||
| <maven.surefire.plugin.version>3.5.2</maven.surefire.plugin.version> | ||
| <!-- Maven build plugins for quality checks --> | ||
| <plexus.compiler.javac.errorprone.version>2.8.5</plexus.compiler.javac.errorprone.version> | ||
| <error.prone.core.version>2.3.2</error.prone.core.version> | ||
| <error.prone.core.version>2.36.0</error.prone.core.version> | ||
| <jacoco.maven.plugin.version>0.8.11</jacoco.maven.plugin.version> | ||
| <spotbugs.maven.plugin.version>4.8.3.1</spotbugs.maven.plugin.version> | ||
| <com.github.spotbugs.version>4.8.3</com.github.spotbugs.version> | ||
|
|
@@ -116,6 +134,31 @@ | |
| <build> | ||
| <pluginManagement> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-clean-plugin</artifactId> | ||
| <version>${maven.clean.plugin.version}</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <version>${maven.compiler.plugin.version}</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-deploy-plugin</artifactId> | ||
| <version>${maven.deploy.plugin.version}</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-enforcer-plugin</artifactId> | ||
| <version>${maven.enforcer.plugin.version}</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-install-plugin</artifactId> | ||
| <version>${maven.install.plugin.version}</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-jar-plugin</artifactId> | ||
|
|
@@ -128,33 +171,77 @@ | |
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <version>${maven.compiler.plugin.version}</version> | ||
| <configuration> | ||
| <compilerId>javac-with-errorprone</compilerId> | ||
| <forceJavacCompilerUse>true</forceJavacCompilerUse> | ||
| <showDeprecation>true</showDeprecation> | ||
| <compilerArgs> | ||
| <arg>-Xlint</arg> | ||
| </compilerArgs> | ||
| </configuration> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.codehaus.plexus</groupId> | ||
| <artifactId>plexus-compiler-javac-errorprone</artifactId> | ||
| <version>${plexus.compiler.javac.errorprone.version}</version> | ||
| </dependency> | ||
| <!-- override plexus-compiler-javac-errorprone's dependency on Error Prone with the latest version --> | ||
| <dependency> | ||
| <groupId>com.google.errorprone</groupId> | ||
| <artifactId>error_prone_core</artifactId> | ||
| <version>${error.prone.core.version}</version> | ||
| </dependency> | ||
| </dependencies> | ||
| <artifactId>maven-resources-plugin</artifactId> | ||
| <version>${maven.resources.plugin.version}</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-site-plugin</artifactId> | ||
| <version>${maven.site.plugin.version}</version> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <version>${maven.surefire.plugin.version}</version> | ||
| </plugin> | ||
| </plugins> | ||
| </pluginManagement> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-enforcer-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <id>enforce-build-environment</id> | ||
| <goals> | ||
| <goal>enforce</goal> | ||
| </goals> | ||
| <configuration> | ||
| <rules> | ||
| <requireJavaVersion> | ||
| <display>true</display> | ||
| <version>[${min.jdk.version},)</version> | ||
| <message>To build this library you need JDK ${min.jdk.version} or higher.</message> | ||
| </requireJavaVersion> | ||
| <requirePluginVersions/> | ||
| </rules> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <configuration> | ||
| <release>${maven.compiler.release}</release> | ||
| <showDeprecation>true</showDeprecation> | ||
| <compilerArgs> | ||
| <arg>-Xlint:all</arg> | ||
| <!-- Error Prone plugin --> | ||
| <arg>-XDcompilePolicy=simple</arg> | ||
| <arg>--should-stop=ifError=FLOW</arg> | ||
| <arg>-Xplugin:ErrorProne</arg> | ||
| <!-- No annotation processors for now --> | ||
| <arg>-proc:none</arg> | ||
| </compilerArgs> | ||
| <!-- | ||
| ~ Due to the changes to annotation processor policy in JDK 23, all annotation processors | ||
| ~ should be mentioned explicitly. | ||
| ~ To add an annotation processor, add it to `annotationProcessors` below and remove | ||
| ~ `-proc:none` above. | ||
| ~ | ||
| ~ See: https://inside.java/2024/06/18/quality-heads-up/ | ||
| --> | ||
| <annotationProcessors/> | ||
| <annotationProcessorPaths> | ||
| <path> | ||
| <groupId>com.google.errorprone</groupId> | ||
| <artifactId>error_prone_core</artifactId> | ||
| <version>${error.prone.core.version}</version> | ||
| </path> | ||
| </annotationProcessorPaths> | ||
| </configuration> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>com.github.spotbugs</groupId> | ||
| <artifactId>spotbugs-maven-plugin</artifactId> | ||
|
|
@@ -250,6 +337,41 @@ | |
| </build> | ||
|
|
||
| <profiles> | ||
|
|
||
| <!-- | ||
| ~ Profile to run tests using JRE 8. | ||
| ~ | ||
| ~ It activates if a toolchains configuration file is present. | ||
| ~ See: https://maven.apache.org/guides/mini/guide-using-toolchains.html | ||
| --> | ||
| <profile> | ||
| <id>java8-tests</id> | ||
| <activation> | ||
| <file> | ||
| <exists>${user.home}/.m2/toolchains.xml</exists> | ||
| </file> | ||
| </activation> | ||
|
Comment on lines
+347
to
+353
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not understand this profile. If the build requires Java 17, how could this be activated and work? What am I missing?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The purpose of this profile is to run tests using JRE 8 in forked JVMs. Note that the CI always has a toolchains configuration.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it - I've never set the Maven Toolchain up. Thanks for the explanation.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hadn't really used it either, but since GitHub automatically sets up the file, it's pretty painless. I think this pull request makes it so that it's not required (presumably, the CI will test Java 8 if the developer does not), but if you're interested, it has a mojo to automatically try to generate the config file
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool! 💯 |
||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <id>default-test</id> | ||
| <configuration> | ||
| <jdkToolchain> | ||
| <version>[1.8,9)</version> | ||
| </jdkToolchain> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </profile> | ||
|
|
||
| <profile> | ||
| <id>release</id> | ||
| <activation> | ||
|
|
@@ -260,17 +382,15 @@ | |
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-enforcer-plugin</artifactId> | ||
| <version>3.4.1</version> | ||
| <executions> | ||
| <execution> | ||
| <id>enforce-java</id> | ||
| <goals> | ||
| <goal>enforce</goal> | ||
| </goals> | ||
| <id>enforce-build-environment</id> | ||
| <configuration> | ||
| <rules> | ||
| <requireJavaVersion> | ||
| <version>1.8.0</version> | ||
| <display>true</display> | ||
| <version>[${min.jdk.version},${max.jdk.version})</version> | ||
| <message>To release this library you need JDK ${min.jdk.version}.</message> | ||
| </requireJavaVersion> | ||
| </rules> | ||
| </configuration> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.