Skip to content

Commit b2d3461

Browse files
committed
Add Mockito as agent for Java 21+
(cherry picked from commit 4649670) Conflicts: pom.xml
1 parent fbb8faf commit b2d3461

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

pom.xml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<logback.version>1.2.13</logback.version>
5050

5151
<maven.dependency.plugin.version>3.8.0</maven.dependency.plugin.version>
52+
<maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
5253
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
5354
<maven.surefire.plugin.version>3.5.0</maven.surefire.plugin.version>
5455
<maven.failsafe.plugin.version>3.5.0</maven.failsafe.plugin.version>
@@ -165,13 +166,27 @@
165166
<groupId>org.apache.maven.plugins</groupId>
166167
<artifactId>maven-dependency-plugin</artifactId>
167168
<version>${maven.dependency.plugin.version}</version>
169+
<executions>
170+
<execution>
171+
<goals>
172+
<goal>properties</goal>
173+
</goals>
174+
</execution>
175+
</executions>
176+
</plugin>
177+
178+
<plugin>
179+
<groupId>org.apache.maven.plugins</groupId>
180+
<artifactId>maven-resources-plugin</artifactId>
181+
<version>${maven.resources.plugin.version}</version>
168182
</plugin>
169183

170184
<plugin>
171185
<groupId>org.apache.maven.plugins</groupId>
172186
<artifactId>maven-compiler-plugin</artifactId>
173187
<version>${maven.compiler.plugin.version}</version>
174188
<configuration>
189+
<release>11</release>
175190
<source>${java.compile.version}</source>
176191
<target>${java.compile.version}</target>
177192
<compilerArgument>-Xlint:unchecked</compilerArgument>
@@ -183,7 +198,8 @@
183198
<artifactId>maven-surefire-plugin</artifactId>
184199
<version>${maven.surefire.plugin.version}</version>
185200
<configuration>
186-
<argLine>${test-arguments}</argLine>
201+
<!-- adding ${argLine} at the beginning is necessary if other plugins set it -->
202+
<argLine>${surefire-test-arguments}</argLine>
187203
<systemPropertyVariables>
188204
<net.bytebuddy.experimental>true</net.bytebuddy.experimental>
189205
</systemPropertyVariables>
@@ -347,13 +363,22 @@
347363
</properties>
348364
</profile>
349365

366+
<profile>
367+
<id>jvm-test-arguments-below-java-21</id>
368+
<activation>
369+
<jdk>[11,21)</jdk>
370+
</activation>
371+
<properties>
372+
<surefire-test-arguments>-Xshare:off</surefire-test-arguments>
373+
</properties>
374+
</profile>
350375
<profile>
351376
<id>jvm-test-arguments-java-21-and-more</id>
352377
<activation>
353378
<jdk>[21,)</jdk>
354379
</activation>
355380
<properties>
356-
<test-arguments>-XX:+EnableDynamicAgentLoading</test-arguments>
381+
<surefire-test-arguments>-Xshare:off -javaagent:${org.mockito:mockito-core:jar}</surefire-test-arguments>
357382
</properties>
358383
</profile>
359384

0 commit comments

Comments
 (0)