无法通过聚合所有模块来生成覆盖率报告

Couldn't able to generate coverage report by aggregating all the modules

错误:

[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.5:report-aggregate (report-aggregate) on project distribution: Unable to parse configuration of mojo org.jacoco:jacoco-maven-plugin:0.8.5:report-aggregate for parameter dataFileIncludes: Cannot assign configuration entry 'dataFileIncludes' with value '**/jacoco-unit.exec' of type java.lang.String to property of type java.util.List -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

pom.xml

          <plugin>
               <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.2</version>
                <executions>
                    <execution>
                        <id>report-aggregate</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                        <configuration>
                            <dataFileIncludes>**/jacoco-unit.exec</dataFileIncludes>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

我无法聚合所有模块并生成单个代码覆盖率报告

有人遇到过这个问题吗? pom.xml 有什么问题?

错误表明 dataFileIncludes 应该是一个列表。 这也是jacoco maven插件源码中的defined

因此您可以尝试通过以下方式将其映射到列表 this document:

          <plugin>
           <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.2</version>
            <executions>
                <execution>
                    <id>report-aggregate</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report-aggregate</goal>
                    </goals>
                    <configuration>
                        <dataFileIncludes>
                           <dataFileInclude>**/jacoco-unit.exec</dataFileInclude> 
                        </dataFileIncludes>
                        <outputDirectory>${project.reporting.outputDirectory}/jacoco-aggregate</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>