Skip to content

Commit

Permalink
- java agents will need to be configured downstream (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgangemi authored Oct 4, 2024
1 parent 2cba9e7 commit 9834024
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Add the following to the downstream maven `pom.xml`. Activation occurs alongside

#### Surefire Tests

Mockito now requires the use of a java agent for instrumentation. Use the `maven-dependency-plugin` to
grab it's jar location which is automatically added to the `surefire` command line.
Mockito, Byte Buddy and others need to be explicitly added as a java agent for instrumentation. Use
the `maven-dependency-plugin` to grab it's jar location and add it to the `argLine`.

```xml

Expand All @@ -51,6 +51,15 @@ grab it's jar location which is automatically added to the `surefire` command li
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}
-javaagent:${net.bytebuddy:byte-buddy-agent:jar}
</argLine>
</configuration>
</plugin>
</plugins>
</build>
```
Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -129,7 +131,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}</argLine>
<excludes>
<exclude>Abstract*.java</exclude>
</excludes>
Expand Down

0 comments on commit 9834024

Please sign in to comment.