gradle7.5 集成jacoco扫描代码覆盖率

最近遇到一个gradle 集成jacoco扫描代码覆盖率的问题,有无知道的朋友,帮忙指点下

jdk Version:11

gradle Version:7.5

jacoco.gradle 部分代码如下:

task jacocoTotalReport(type: JacocoReport, dependsOn: project.getTasksByName("testDebugUnitTest", true)) {
    doFirst {
        subprojects.each { project ->
           
            def unitTestResultFile = "${project.buildDir}/jacoco/testDebugUnitTest.exec"

            if (file(unitTestResultFile).exists() && executionData != null) {
                executionData.setFrom(unitTestResultFile) //执行到这里时报以下错误信息
            }
        }
    }
}


报错信息
* What went wrong:
Execution failed for task ':jacocoTotalReport'.
> The value for this file collection is final and cannot be changed.