Pull up surefire and failsafe config so all modules and plugins use it (#23478)

This commit is contained in:
Bernd Ahlers
2025-08-28 19:06:04 +02:00
committed by GitHub
parent 59a4b7d317
commit 0efe581c32
2 changed files with 38 additions and 49 deletions

View File

@@ -549,55 +549,6 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<!-- Required to get Mockito's JAR path for the surefire argLine. -->
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<!-- See: "Explicitly setting up instrumentation for inline mocking (Java 21+)" at
https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3 -->
<argLine>-javaagent:${org.mockito:mockito-core:jar} -Dio.netty.leakDetectionLevel=paranoid -Djava.awt.headless=true</argLine>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*IT.java</exclude>
</excludes>
<includes>
<include>**/*Spec.class</include>
<include>**/*Test.class</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<skip>false</skip>
<argLine>-Djava.awt.headless=true</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>

38
pom.xml
View File

@@ -89,6 +89,12 @@
<!-- This property will be overridden during the release to collect all artifacts in a central location. -->
<local.repo.path>${project.build.directory}/local-maven-repo</local.repo.path>
<!-- See: "Explicitly setting up instrumentation for inline mocking (Java 21+)" at
https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3
We use the "@{}" property syntax to delay property resolution for the argLine config in surefire. -->
<common.surefire.args>-javaagent:@{org.mockito:mockito-core:jar} -Dio.netty.leakDetectionLevel=paranoid -Djava.awt.headless=true</common.surefire.args>
<common.failsafe.args>-Djava.awt.headless=true</common.failsafe.args>
<!-- Dependencies -->
<opensearch.shaded.version>2.19.3-1</opensearch.shaded.version>
<airline.version>3.1.0</airline.version>
@@ -715,12 +721,44 @@
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<!-- Required to get Mockito's JAR path for the surefire argLine. -->
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<trimStackTrace>false</trimStackTrace>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<argLine>${common.surefire.args}</argLine>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*IT.java</exclude>
</excludes>
<includes>
<include>**/*Spec.class</include>
<include>**/*Test.class</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<skip>false</skip>
<argLine>${common.failsafe.args}</argLine>
</configuration>
<executions>
<execution>