Maven
There are multiple options how to kickstart for example a JUnit test
1. Using MAVEN_OPTS environment variables (eg. in the Jenkins build configuration)
The agentLibrary can be set as follows:
MAVEN_OPTS="-Xms1G -Xmx1G -agentpath:/opt/takipi/lib/libTakipiAgent.so”
Additionally, we could also set the JVM arguments here for
- takipi.application.name
- takipi.deployment.name
- takipi.resources.dir
MAVEN_OPTS="-Xms1G -Xmx1G -agentpath:/opt/takipi/lib/libTakipiAgent.so -Dtakipi.application.name=ShoppingCartApplicaiton
-Dtakipi.deployment.name=v1.5 -Dtakipi.resources.dir=${HOME}”
2. Using the maven command line
-DargLine=“-Dsystem.test.agentpath=/takipi/lib/libTakipiAgent.so -Dtakipi.resources.dir=${HOME}
-Dtakipi.application.name=ShoppingCart
-Dtakipi.deployment.name=ShoppingCart.${BUILD_NUMBER}"
3 Using Maven Surefire Plugin
Do not use
<systemPropertyVariables>
or<additionalClasspathElements>
!
Instead use<argLine>
as shown below.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testNg.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>-agentlib:TakipiAgent -Dtakipi.name=ShoppingCartJUnitTests -Dtakipi.deployment.name=v4.6</argLine>
</configuration>
</plugin>
4. Using JAVA_TOOLS_OPTIONS
JAVA_TOOL_OPTIONS=-agentpath:/path/to/libTakipiAgent.so -Dtakipi.name=ShoppingCart -Dtakipi.deployment.name=v1.5
Using JAVA_TOOL_OPTIONS is not a recommended way since it will attach to all JVM’s that are running with that JAVA_HOME
See also
Updated over 4 years ago