Skip to content

Commit 17a1edd

Browse files
Configure argLine per Mockito documentation
Following Mockito documentation section 0.3, configure surefire/failsafe with @{argLine} late replacement and -XX:+EnableDynamicAgentLoading flag. Added empty argLine property as required by documentation to prevent "VM crash or System.exit called" error when JaCoCo is not active. Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent 2bb9d16 commit 17a1edd

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

pom.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
<lifecycle-mapping.version>1.0.0</lifecycle-mapping.version>
2525
<jjwt.version>0.13.0</jjwt.version>
2626
<okhttp.version>5.3.2</okhttp.version>
27-
<!-- Enable dynamic agent loading for Mockito/Byte Buddy as recommended by Mockito docs -->
28-
<argLine>-XX:+EnableDynamicAgentLoading</argLine>
27+
<!-- Default empty argLine property - required for @{argLine} late replacement -->
28+
<argLine></argLine>
2929
</properties>
3030
<organization>
3131
<name>Berry Cloud Ltd</name>
@@ -103,9 +103,19 @@
103103
</dependency>
104104
</dependencies>
105105
</plugin>
106+
<plugin>
107+
<groupId>org.apache.maven.plugins</groupId>
108+
<artifactId>maven-surefire-plugin</artifactId>
109+
<configuration>
110+
<argLine>@{argLine} -XX:+EnableDynamicAgentLoading</argLine>
111+
</configuration>
112+
</plugin>
106113
<plugin>
107114
<groupId>org.apache.maven.plugins</groupId>
108115
<artifactId>maven-failsafe-plugin</artifactId>
116+
<configuration>
117+
<argLine>@{argLine} -XX:+EnableDynamicAgentLoading</argLine>
118+
</configuration>
109119
<executions>
110120
<execution>
111121
<goals>

0 commit comments

Comments
 (0)