Hi! 

I was able to startup my multi-module application instance located on a 
different server than my jenkins build server with the following JVM option : 
"-javaagent:${MAIN_DIR}/lib/jacocoagent.jar==destfile=/jacoco.exec,output=tcpserver,address=*"

In my Jenkins build I have Pre Steps going as follow : An ant task that calls 
target jacocoReport. The build.xml I'm using for this purpose has the following 
code;

<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
    <classpath path="/opt/hudson/tools/jacocoant.jar"/>
</taskdef>

<target name="jacocoReport">
        <jacoco:dump address="${jacoco.host}" port="${jacoco.port}" dump="true" 
reset="true" destfile="${jacocoReportFile}" append="false"/>
</target>

<target name="jacocoReset">
        <jacoco:dump address="${jacoco.host}" port="${jacoco.port}" 
reset="true" destfile="${jacocoReportFile}" append="false"/>
    <delete file="${jacocoReportFile}"/>
</target>
And finally I have a maven build step which calls sonar:sonar

Here's the section in the POM relative to my integration report;

<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.itReportPath>${WORKSPACE}/it-jacoco.exec</sonar.jacoco.itReportPath>
<sonar.language>java</sonar.language>
<sonar.branch>9.9.5</sonar.branch>
and here's my plugin configuration :

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <configuration>
          <append>true</append>
        </configuration>
        <executions>
          <execution>
            <id>pre-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>post-test</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
              <goal>report-integration</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
When the build finishes, my Sonar entry still shows at 0% for my integration 
tests. But when I take the same it-jacoco.exec report and import it using 
Eclipse's Jacoco import Coverage session, I get 26% coverage.

Finally when I look into my Jenkins build logs I see the following;

Sensor JaCoCoItSensor...
Analysing /var/lib/jenkins/workspace/XXXXXX/it-jacoco.exec
No information about coverage per test.
Sensor JaCoCoItSensor done: 34 ms
I don't have any automated integration tests right now, I only wish to import 
the integration report from my external test machine.

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/a270d21a-53c2-444d-a9ec-9a794eeba4e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to