Can't figure out how to integrate surefire reports in a multiproject maven build

467 views
Skip to first unread message

David Karr

unread,
Mar 23, 2017, 6:54:34 PM3/23/17
to SonarQube
I have a multiproject maven build that I'm scanning with sonar-scanner.  I've been able to integrate JaCoCo code coverage reports, but I realized today that I never integrated my unit test reports.  In our case, it doesn't get to the sonar scan unless all the unit tests pass, but it would still be nice to show the count of unit tests and be able to navigate to the list of them.

In our build, we have a top-level aggregator pom that specifies all the modules to build.  Each of those modules ends up with a "target" directory which contains a "surefire-reports" directory, which has the unit test reports.

I tried setting "sonar.junit.reportsPath" to "target/surefire-reports" in the same way that I set all of my (working) Sonar properties, but that didn't appear to make any difference.

I'm using SonarQube 5.6.5.

David Karr

unread,
Mar 24, 2017, 12:55:13 PM3/24/17
to SonarQube

It does appear that this property is expected to be a single directory. How am I supposed to integrate the reports from multiple subprojects in a multiproject build?

David Karr

unread,
Mar 24, 2017, 5:06:25 PM3/24/17
to SonarQube

I was able to get this to work by using the resources plugin to copy all of the files in all of the "target/surefire-reports" directories, to a single place, so I can specify the single directory in the property.  I now have a single POM that has three different lists of all the modules in my multiproject project, two of which are there because of limitations in what I can specify in Sonar properties. One of those two is to create a merged jacoco.exec file. There actually is a property that can specify a list of jacoco.exec files, but that doesn't work in my somewhat older version of SonarQube (the third list is to merge the jacoco HTML output).

Tibor Blenessy

unread,
Mar 29, 2017, 9:19:01 AM3/29/17
to David Karr, SonarQube
Hello David,

we have this ticket to fix property for JUnit reports SONARJAVA-2191  . The jacoco property should already work this way since SonarQube 6.2 and SonarJava 4.4 (see SONARJAVA-1887). Unfortunately I can't help you if you have to use old versions.

Best regards


--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/52318014-76b3-47fb-80c5-549d38c769c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Tibor BLENESSY | SonarSource
SonarJava Developer
Reply all
Reply to author
Forward
0 new messages