3
votes

Let's say Main module A And Sub modules are B and C .In my gradle file I have added only below configuration for sonar and jacoco.

apply plugin: 'spring-boot'
apply plugin: 'org.sonarqube'
app vly plugin: 'jacoco'

jacocoTestReport {
    group = "Reporting"
    description = "Generate Jacoco coverage reports after running tests."
    additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
}

sonarqube {
    properties {
        property "sonar.projectName", "A"
        property "sonar.projectKey", "org.codehaus.sonar:A"
        property "sonar.jacoco.reportPath", "${project.buildDir}/jacoc /test.exec"
        property "sonar.jacoco.itReportPath", "${project.buildDir}/jacoco/jacoco-it.exec"
    }
}

when I run the gradle task : ./gradlew clean :A:sonarqube -Pprod Build Successful but showing below info

INFO - JaCoCoItSensor: JaCoCo IT report not found: /../../../../A/build/jacoco/jacoco-it.exec

Integration tests are working fine. but only show the code coverage of main module. What I want is, when I run the integration test, the sub module code also covered in the code coverage report.

1

1 Answers

1
votes

You may want to take a look at sonarqube gradle plugin excluding jacoco integration tests

It seems that this property is not available