You need to configure
jacoco:prepare-agent to prepare the maven
test phase that generated the
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
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
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?
Thanks for your response. We have an entreprise Edition.
SonarQube 8.1 Enterprise Edition (like all commercial editions) supports import of coverage on branch analysis.
So if coverage import is working for
master branch, it should also work on other branches.
(except if your gitlab sonarqube analysis configuration if different for master branch compare to other branches)
Could you provide more context about your configuration, so we can reproduce your problem?