It is not possible to use integration coverage with sonar in a multi-module project

I have a multi-module project and you want to visualize the coverage of the integration code using SonarQube. I can generate test.exec and integTest.exec (JaCoCo), but there is a problem to force sonar-runner (sonar-jacoco-plugin) to use them. sonar runner reports:

The project coverage is set to 0%, since there are no directories with classes.

which is true as for the root project (where the integTest.exec file is generated) does not have source files (but this should not be a problem to cover integration). My configuration:

(...)
sonar.dynamicAnalysis=reuseReports
sonar.jacoco.reportPath=build/jacoco/test.exec
sonar.jacoco.itReportPath=build/jacoco/integTest.exec
sonar.modules=mod1,mod2
sonar.sources=src/main/java,src/main/resources
sonar.tests=src/test/java,src/test/groovy,src/test/resources
sonar.binaries=build/classes/main,build/resources/main

The project is built using Gradle, but due to CI limitations, I need to use sonar-project.propertiesthe sonar-runner configuration (and not the Gradle sonar plugin that worked for me in the past).

Update. sonar-jacoco-plugin , , , , sonar-runner sonar.binaries .

. , ?

+3
1

, :

sonar.jacoco.reportPath=../build/jacoco/test.exec
sonar.jacoco.itReportPath=../build/jacoco/integTest.exec

( mod1, mod1a mod1b):

mod1.sonar.jacoco.reportPath=../../build/jacoco/test.exec
mod1.sonar.jacoco.itReportPath=../../build/jacoco/integTest.exec

, , , - .

+2

All Articles