1

Below is the code snippet I'm using in gradle 7.1.1 and Jacoco version 0.8.4 and getting a build error

Could not find method setFrom() for arguments [file collection] on main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.

jacocoTestReport {
group = "Reporting"
reports {
        xml.enabled false
        csv.enabled false
        html.enabled true
        html.destination "${buildDir}/reports/jacoco"
    }
    afterEvaluate {
        classDirectories.setFrom(files(classDirectories.files.collect {
            fileTree(dir: it,
                exclude: [
                          ''
                          ]
            )
        }))
    }
}
James Z
  • 12,209
  • 10
  • 24
  • 44
user1905
  • 15
  • 6

1 Answers1

0

It is caused by the version of gradle you used.

you can check out this post, it describes this problem in every detail

I encounter the same exception when running a unit test, using gradle-4.10.

Solve the problem when I used gradle-7.2

Noah Hsu
  • 36
  • 3