Sonarqube 8.1, Code Coverage branches 0%

Hi Egar,

You need to configure jacoco:prepare-agent to prepare the maven test phase that generated the target/jacoco.exec. But jacoco:prepare-agent is not needed by the sonar:sonar goal. What sonar:sonar needs it’s the target/site/jacoco/jacoco.xml file generated by the report phase. Do you have this jacoco.xml file? If not, this means that you need to configure jacoco:report.
See [Coverage & Test Data] Importing JaCoCo coverage report in XML format
Then try to run mvn -X sonar:sonar , you should see:

[INFO] 16:59:10.201 Sensor JaCoCo XML Report Importer [jacoco]
[INFO] 16:59:10.201 1/1 source files have been analyzed
[DEBUG] 16:59:10.203 Reading report '/home/user/project/target/site/jacoco/jacoco.xml'
[INFO] 16:59:10.208 Sensor JaCoCo XML Report Importer [jacoco] (done) | time=7ms

Note: you can also provide jacoco xml report path using sonar.coverage.jacoco.xmlReportPaths

And last question: How did you add the branch support to SonarQube? Do you have a commercial edition or the community edition with an additional plugin?