Skip to content

chore: add build support for newer JDKs #948

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

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 75 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<module-name>${groupId}.${artifactId}</module-name>
<javadoc.failOnWarnings>true</javadoc.failOnWarnings>
<!-- This is required for later correct replacement of surefireArgLine -->
<!-- see surefire-java8 and surefire-java9+ profiles -->
<surefireArgLine/>
</properties>

<dependencies>
Expand Down Expand Up @@ -92,6 +95,24 @@
<scope>test</scope>
</dependency>

<!-- Start mockito workaround -->
<!-- https://github.com/mockito/mockito/issues/3121 -->
<!-- These are transitive dependencies of mockito we are forcing -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.15.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.15.1</version>
<scope>test</scope>
</dependency>
<!-- End mockito workaround-->

<dependency>
<groupId>uk.org.lidalia</groupId>
<artifactId>slf4j-test</artifactId>
Expand Down Expand Up @@ -206,19 +227,6 @@
<version>3.13.0</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<excludes>
<!-- tests to exclude -->
<exclude>${testExclusions}</exclude>
</excludes>
<argLine>${surefireArgLine}</argLine>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down Expand Up @@ -433,6 +441,60 @@
</plugins>
</build>

<profiles>
<!-- profile for running tests under java 8 (used mostly in CI) -->
<!-- selected automatically by JDK activeation (see https://maven.apache.org/guides/introduction/introduction-to-profiles.html#implicit-profile-activation) -->
<profile>
<id>surefire-java8</id>
<activation>
<!-- JDK 1.8 -->
<jdk>1.8</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<excludes>
<!-- tests to exclude -->
<exclude>${testExclusions}</exclude>
</excludes>
<argLine>@{surefireArgLine}</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<!-- profile for running tests under java 9+ (used for dev environments where people don't want to be locked to Java 8) -->
<!-- selected automatically by JDK activeation (see https://maven.apache.org/guides/introduction/introduction-to-profiles.html#implicit-profile-activation) -->
<profile>
<id>surefire-java9+</id>
<activation>
<!-- JDK 1.9+ -->
<jdk>[1.9,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<excludes>
<!-- tests to exclude -->
<exclude>${testExclusions}</exclude>
</excludes>
<argLine>@{surefireArgLine} --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
Expand Down