0
votes

I've got a multimodule Gradle 4.6 project and Sonarqube 7. Sonarqube and Jacoco are configured as follows:

apply plugin: 'org.sonarqube'

sonarqube {
    properties {
        property 'sonar.host.url', sonarHostUrl
        property 'sonar.jacoco.reportPaths', "$buildDir/reports/jacoco"
    }
}

apply plugin: 'jacoco'

jacoco {
    toolVersion = "0.7.9"
}

jacocoTestReport {
    group = "Reporting"
    reports {
        xml.enabled true
        xml.destination "${buildDir}/reports/jacoco/report.xml"
        csv.enabled false
        html.enabled true
    }
}

test {
    jacoco {
        append = true
    }
}

I'm running build and sonar with the following commands:

./gradlew clean build jacocoTestReport --info

./gradlew sonarqube -Dsonar.branch=nonMasterBranch --info

I expect it go aggregate Sonar report and show me a single project in Sonarqube (I'm using append=true in the jacoco configuration). However, I'm getting a project per module that is very messy.

Thank you very much for any ideas! I've been working with this hell task for too much time and no thoughts:C

1

1 Answers

0
votes

According to this answer, you should try the Jacoco Coverage Gradle Plugin

Just add this in your root project :

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.palantir:jacoco-coverage:0.4.0'      
    }
}

apply plugin: 'com.palantir.jacoco-full-report'

According to the documentation :

The com.palantir.jacoco-full-report plugin adds a task that produces a Jacoco report for the combined code coverage of the tests of all subprojects of the current project.