Using SonarQube 7.7 (community), Jacoco Plugin 1.0.1 (build 143).
We have a more or less standard Tycho build with eclipse-plugin and eclipse-test-plugin modules inside a multi-module maven structure. Because of this nature, an eclipse-test-plugin never contains sources of their dependencies.
We are using the common Tycho approach of a global jacoco.exec file with reuseReports. This works.
Now, SonarQube complains about this approach being deprecated, and we should use the Jacoco XML Reports instead. So, knowing how fast SonarQube deprecations are enforced in general, I wanted to act on it before it is too late.
Problem is: I can not get SonarQube to import those XML reports.
If I keep the global jacoco.exec, and run mvn jacoco:report, it does not generate anything useful in the jacoco report (HTML and XML). Running mvn jacoco:report-aggregate, it creates nothing useful in any report. In both cases, I can not expect SonarQube to do something useful.
If I remove the usage of a global jacoco.exec, the separate jacoco.exec files are generated in the test plugins target directories, as expected. Running mvn jacoco:report on this, only coverage information of the test classes is in the report, which is even less than nothing. Running mvn jacoco:report-aggregate, the aggregate contains only coverage information of the dependencies having sources - which is PERFECT (or so I thought).
So the only combination found working is: separate jacoco.exec files for each module, running mvn jacoco:report-aggregate afterwards.
But (and here it comes): SonarQube analysis does seem to pick up the report file (at least it says ā[DEBUG] 11:57:37.413 Reading report āpath\to\eclipse-bundle\target\site\jacoco-aggregate\jacoco.xmlāā with mvn sonar:sonar -X). The path is correct, the file is there, and it contains expected content. But the coverage in the project within SonarQube is 0%.
Unfortunately, the SonarQube docs do not reflect this deprecation yet. [1] talks only about the binary format. [2] says the XML format should be used, but not, how it is generated.
Can you please elaborate on how to generate the Jacoco XML report in a multi module maven project with extensive dependencies between the modules, and the test projects only containing sources for tests and not the code to be tested, to have it correctly being picked up by SonarQube?
Thank you very much.
[1] https://docs.sonarqube.org/display/PLUG/Usage+of+JaCoCo+with+SonarJava
[2] https://docs.sonarqube.org/display/PLUG/JaCoCo+Plugin