JaCoCo agent is not tracking code coverage info
<p>I have a Java web application running on a Wildfly 9 server and I use the <a href="https://github.com/jmeter-maven-plugin/jmeter-maven-plugin" rel="nofollow noreferrer">jmeter-maven-plugin</a> to run some performance tests on the running instance of my application. Those tests run simple REST requests to my application's services.</p>

<p>What I would like to do is retrieve the code coverage statistics of the performance tests so that I always know what is the amount of covered code of my performance tests.</p>

<p>Following <a href="https://stackoverflow.com/questions/33211983/jacoco-code-coverage-for-remote-machiene">this</a>, <a href="https://stackoverflow.com/questions/8991364/code-coverage-of-jboss-as-7-testsuite-using-jacoco-no-data-in-jacoco-exec-fil">this</a> and <a href="https://stackoverflow.com/questions/13952035/how-to-attach-jacoco-agent-to-application-server">this</a> StackOverflow threads I setup the JaCoCo Java agent on the server. This is the agent configuration at startup</p>

<pre><code>set "JAVA_OPTS=%JAVA_OPTS% -javaagent:/path/to/jacocoagent.jar=output=tcpserver,address=*,port=6300,includes=my.package.*"
</code></pre>

<p>Also, I configured the <a href="http://www.eclemma.org/jacoco/trunk/doc/maven.html" rel="nofollow noreferrer">jacoco-maven-plugin</a> on the tests Maven project in order to let it run a dump on the server to retrieve the execution information.</p>

<pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
    &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;0.7.7.201606060606&lt;/version&gt;
    &lt;configuration&gt;
        &lt;destFile&gt;${sonar.jacoco.itReportPath}&lt;/destFile&gt;
        &lt;append&gt;false&lt;/append&gt;
    &lt;/configuration&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;id&gt;jacoco-dump&lt;/id&gt;
            &lt;phase&gt;verify&lt;/phase&gt;
            &lt;goals&gt;
                &lt;goal&gt;dump&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
                &lt;address&gt;my.server&lt;/address&gt;
                &lt;skip&gt;${skipJMeterTests}&lt;/skip&gt;
                &lt;!-- &lt;reset&gt;true&lt;/reset&gt; --&gt;
            &lt;/configuration&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;
</code></pre>

<p>So, when I run <code>mvn verify</code> all performance tests run (so the REST services are indeed called) and the JaCoCo plugin correctly dumps the server jacoco.exec file, but when I inspect this file running <code>mvn sonar:sonar</code> I get a 0% coverage of code even though the services were called by the performance tests.</p>

<p>What could be the problem? I tried different configurations of the agent and plugin but seemed to not solve my problem.</p>

<p>Thank you</p>