How to attach JaCoCo Agent to application server How to attach JaCoCo Agent to application server selenium selenium

How to attach JaCoCo Agent to application server


The javaagent needs to be passed as a VM option like this :

-javaagent:[path to Jenkins workspace]/tools/libs/jacocoagent.jar=destfile=[path to Jenkins]/jacoco.exec

You are passing it as a system property (using -D).

You can pass VM options to the Jboss application server through a JAVA_OPTS environment variable. (the run.sh will pick it up if the JAVA_OPTS is exported before running the run.sh script). Something like this should do :

export JAVA_OPTS="$JAVA_OPTS -javaagent:[path to Jenkins workspace]/tools/libs/jacocoagent.jar=destfile=[path to Jenkins]/jacoco.exec"./run.sh

More information on the javaagent configuration can be found here :

http://www.eclemma.org/jacoco/trunk/doc/agent.html