Unable to exclude generated package from Jacoco test report using Kotlin DSL

I have a Kotlin project and I’m using Kotlin DSL for my Gradle build. I’m trying to exclude a certain generated package from the Jacoco test report. I used the below but it doesn’t seem to work.

tasks.getByName<Test>("test") {
    extensions.configure<JacocoTaskExtension> {
       excludes = listOf("com.foo.bar.*")
    }
}

Am I doing it wrong in some way? My Jacoco report still shows my generate package with 0% coverage.

Any help is appreciated.

1 Like

Did you managed to find a solution for this?