Aggregating Junit5 XML report

Hello Team !
I have multi-module, multi-language repo which I am scanning using SonarScanner 4.3. On Sonar dashboard, I am not able to show unit test count of my Junit5 test.

As per my debugging, understood that I have to provide Junit XML report to sonar.junit.reportPaths= property to show the count.

I do not want to provide hard coded value to this property. So option which I am exploring is if somehow if I can aggregate all the Junit5 XML report under repository at root project level then I can just point the sonar.junit.reportPaths= property to that location.

My Java build is via Gradle and I do see following option which is for HTML report and not for XML reports.

task junit5TestReport(type: TestReport) {    
    destinationDir = file("$buildDir/reports/tests/test")    
    // Include the results from the `test` task in all subprojects
    reportOn subprojects*.test

Any way to get similar thing for XML reports? Or some other options?

I tried a simple solution of gradle copying the required files from all subproject to root project directory.

task junit5TestReport(type: Copy) {
    from subprojects*.test
    into './build/reports/test'
    include '*.xml'
test.finalizedBy junit5TestReport


If you’re building with Gradle, then you should analyze with Gradle too. Most of your project config will be picked up automatically, and you should be saved from having to deal with this configuration.