Consolidate Jacoco reports from multiple builds at different phases

Hello Everyone,

I am looking to see if sonarqube provides a way to append instead of overwrite coverage data specifically for jacoco reports. we have multiple jacoco reports during different phases of the build process. We would like to augment the coverage report after each build but to the same project. Is it possible to write a plugin that will intercept a xml file being uploaded and then check if existing coverage exists. And if so then merge the uploaded and existing(Saved in DB) into one coverage report and save it?

Hey there.

I’m a bit confused – are all your coverage reports available by the time you run SonarQube analysis, or is SonarQube analysis happening multiple times during your build with different coverage reports?

Hi Colin,

The build has different phases. Each phase produces some portion of the code coverage for unit tests, basically code for each team. Then it generates another jacoco report for integration runtime in another build. So we want the ability to aggregate these jacoco reports over time. Not all are present before we run analysis.

“SonarQube analysis happening multiple times during your build with different coverage reports?”

Hey there.

SonarQube will require that all coverage reports are present before the analysis runs. Typically this means that anlaysis is the last thing to happen (after all the tests have run). It’s not currently possible to enrich an analysis already submitted with SonarQube with coverage results generated later, or prevent existing coverage results from being overwritten with a new analysis.

hence i was asking if its possible to write a plugin that will intercept new reports and merge them with an existing one if it exists?