I have a simple java project with on Junit test case that has the current architecture:
pom.xml
src/main/java/com/Example.Java
src/test/java/com/ExampleTest.java
The contents of pom.xml are as follow:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>SampleExample</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
To execute the tests I simply call mvn test from bash. This as expected will run the test. Now to my question:
specifying javagent outside of maven is simply done by specificity the -javaagent option. How do I do this within the maven framework such that when I execute mvn test the agent I specify is loaded? (i.e how do I add custom arguments that maven will pass to the 'java' command when the tests are executed)