I have a big Java nested multi-module Maven project. Build and tests are fine.
JaCoCo generate a unique jacoco.xml, allong other extention. If I open index.html, I get what I like to see in SonarQube
...
[INFO] 17:05:51.144 Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[DEBUG] 17:05:51.145 Reading report '/home/jenkins/workspace/nucleus-pipline/aggregate-report/target/site/jacoco-aggregate/jacoco.xml'
[INFO] 17:05:51.172 Sensor JaCoCo XML Report Importer [jacoco] (done) | time=28ms
...
Maven structure
root project
nucleus (pom)
backend (pom)
model-backend (jar)
system-backend (jar)
modules (pom)
sample-module (jar)
many others…
rest
many others…
aggregate-report (pom)
Do you have an idea?
Or do you need more logs or informations?
And if it fails, can you add -X to your analysis command line to generate debug logs, so we can see the details promised here:
[INFO] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=125ms
This step was indeed specified in SonarQube tutorial. Here you have log with setup explain in tuto : nucleus-jacoco-sonar.log (6.7 MB)
It seems odd because ${project.basedir} reference current sub-module and not the common one for aggregation (log show no report found at this location).
So I used another maven variable to always fall back to same folder of aggregation report :
But only when I build releases. Coverage come back to 0.0 for SNAPSHOT…
I going to cross check differences between release and snapshot builds and come back to you.
Finger crossed that is ‘only’ a bug on SNAPSHOT build!
what Camille Dell Ava did does fix the issue (meaning the definition of the sonar.coverage.jacoco.xmlReportPaths using maven.multiModuleProjectDirectory)
the way the tutorial defines it does not work (meaning with the usage of project.basedir property, the reasoning is that which was previously mentioned of it taking the value of each individual sub-module, causing the other reports to be used instead of the aggregate one
It seems odd because ${project.basedir} reference current sub-module and not the common one for aggregation (log show no report found at this location).
I tried finding more info about maven.multiModuleProjectDirectory and I found this SO Answer and it seams using it might be dis-encouraged and may cause the project to break on future maven versions
What I would like to get out of this comment is an enhancement on the configuration described the tutorial to make sure we get a consistent set up