为什么 Jacoco 合并不包括文件?

Why is Jacoco merge not including files?

我有一个多模块 maven 项目,并尝试使用 Jacoco 生成聚合报告,然后 运行 'aggregated' 检查。但是,我无法以任何可能的方式让 Jacoco 合并功能通过 Maven 插件工作。 因此,我尝试创建一个最小示例,如下所示

项目只包含三个文件,maven pom文件和两个Jacoco exec文件(之前生成的)

pom 文件内容如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.jacoco</groupId>
    <version>0.1-SNAPSHOT</version>
    <artifactId>coverage</artifactId>

    <name>Coverage report</name>
    <description>Coverage report module</description>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>merge-results</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>merge</goal>
                        </goals>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <directory>${basedir}/}</directory>
                                    <includes>
                                        <include>*.exec</include> <!-- In the end, I tried a lot of different include options, but nothing seems to work -->
                                        <include>jacoco1.exec</include>
                                        <include>jacoco2.exec</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

当我 运行 mvn verify -X 我在合并目标下得到以下调试输出:

[DEBUG] Configuring mojo org.jacoco:jacoco-maven-plugin:0.8.6:merge from plugin realm ClassRealm[plugin>org.jacoco:jacoco-maven-plugin:0.8.6, parent: sun.misc.Launcher$AppClassLoader@5c647e05]
[DEBUG] Configuring mojo 'org.jacoco:jacoco-maven-plugin:0.8.6:merge' with basic configurator -->
[DEBUG]   (f) destFile = /Users/rsn/git/coverage-mve/coverage/target/jacoco.exec
[DEBUG]   (s) directory = /Users/rsn/git/coverage-mve/coverage/}
[DEBUG]   (s) includes = [*.exec, jacoco1.exec, jacoco2.exec]
[DEBUG]   (f) fileSets = [org.apache.maven.shared.model.fileset.FileSet@56681eaf]
[DEBUG]   (f) project = MavenProject: com.jacoco:coverage:0.1-SNAPSHOT @ /Users/rsn/git/coverage-mve/coverage/pom.xml
[DEBUG]   (f) skip = false
[DEBUG] -- end configuration --
[INFO] Skipping JaCoCo merge execution due to missing execution data files

Maven 版本为

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Default locale: en_DK, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "Mac"

我尝试下载 jacococli.jar 并手动将文件与其合并,效果很好。我想这可以下载并 运行 使用 Maven ant 运行 插件作为解决方法,但我更愿意只使用插件!

任何可能导致此问题的想法?

你的

<fileSet>
  <directory>${basedir}/}</directory>

看起来很可疑 - 注意尾随的花括号,它可能被解释为目录名称。