How to feed externally generated JaCoCo report to SonarQube?

SonarQube Version 6.7.4 (Community Edition)

We are evaluating SonarQube, mainly focusing on code coverage part using Jacoco. It works well when both build and JaCoCo runs on same machine. We build our services (java) on Build Machine (Jenkins Node) where test execution happens on a remote docker host. Currently our Jenkins pipeline; at the end of test execution on docker container, its jacoco.exec file get downloaded to Jenkin’s workspace then publish in Jenkins. We want the same approach to be followed where sonarquebe should be able to use the jaccoco.exec that executed and produced on remote docker container other than build machine. When we download the jacoco.exec from docker host and fed to sonar, its not processing. It seems like jacocco.exec file contains host information in it and sonar-scanner excluding it.

Can anyone know how this can be achieved? We can’t execute both build and jacocco on same machine as we are using dockerised test image out of service docker image and test execution needs to be executed on docker container.

Thanks in advance,

@rijeshpp Are you still experiencing your problem?

I am also facing similar issue where we run the jacoco-java-agent on different machine(where our source code is running) and we get a jacoco-exec, jacoco-report.xml files out of it.

I am not sure how to feed generated jacoco data to sonarqube server which is running as a standalone server in different machine.

Appreciate if anyone helps here.

In order to import your coverage report to your sonarqube, you will need to run an analysis on your source code and, using the JaCoCo plugin you’ll need to specify where to find the jacoco.xml report using the property.

Hope That Helps