简体   繁体   中英

Jacoco exclude class coverage report zero for only branch

I am trying to exclude a class from our jacoco report. I did the following in build.graddle file:

jacocoTestReport {
    dependsOn {
        test
    }
    reports {
        xml.enabled true
    }
    afterEvaluate {
        classDirectories.setFrom(files(classDirectories.files.collect {
            fileTree(dir: it, exclude: [
                    '**/DSApplication.class'
            ])
        }))
    }
}

It works well for excluding it from "brunch" coverage but the rest options (like "complexity" or "line") are still showing zero coverage. How can I fix that?

Apparently there is an option in SonarQube, with we use for build, that makes proper code coverage exclude.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM