Skip to content Skip to sidebar Skip to footer

Jacoco Gradle Plugin Exclude

I want to exclude some clasess from JaCoCo but the exclude doest seem to work. For example i want to exclude all Java clasess that end with Dao (for example com.company.EmplyeeDao)

Solution 1:

Try something like this:

excludes: ['**/Dao*.class']

But as I understand, this will exclude the class from jacoco but the Report that Jacoco creates will show you "0% of coverage": Gradle issue: https://issues.gradle.org/browse/GRADLE-2955

Solution 2:

For newer version of gradle (6+) use this:

jacocoTestCoverageVerification {
    violationRules {
        rule {
            includes = ['com/myapp/*']
            excludes = [
                    'com/myapp/folderToExclude1/*',
                    'com/myapp/folderToExclude2/*',
            ]
           limit {
                minimum = 0.85
            }
        }
    }
}

Post a Comment for "Jacoco Gradle Plugin Exclude"