2

我根据https://pitest.org/aggregating_tests_across_modules/在一个 Maven 模块项目(Maven 版本 3.5.4)中集成了 Pitest。

当运行mvn clean package日志显示目标模块(即应该执行 Pitest 的模块)的 Pitest 执行时,我确认实际生成了结果文件。

但是,我收到报告模块的以下错误消息:

[ERROR] Failed to execute goal org.pitest:pitest-maven:1.5.1:report-aggregate (put-it-together) on project mutationtesting:
An error has occurred in PIT Test Report report generation.:
.../.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.10.0/jackson-databind-2.10.0.jar is not a directory

jackson-databind是目标模块的依赖关系,因此是报告模块的传递依赖关系。在我看来,report-aggregate目标还试图分析启用 Pitest 的模块的传递依赖关系。

项目配置是否有错误?这是一个已知的错误?我能做些什么?

我尝试将reporting模块中target modules的范围改为provided,并且我也将reporting module的packing设置为pom,但无济于事。

配置

我在父 POM 中配置了 Pitest,如下所示:

        <properties>
            ...
            <pitest.version>1.5.1</pitest.version>
            <pitest.junit5.version>0.12</pitest.junit5.version>
        <properties>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.pitest</groupId>
                    <artifactId>pitest-maven</artifactId>
                    <version>${pitest.version}</version>

                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>mutationCoverage</goal>
                            </goals>
                        </execution>
                    </executions>

                    <configuration>
                        <exportLineCoverage>true</exportLineCoverage>
                        <outputFormats>
                            <value>XML</value>
                        </outputFormats>
                        <timestampedReports>false</timestampedReports>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.pitest</groupId>
                            <artifactId>pitest-junit5-plugin</artifactId>
                            <version>${pitest.junit5.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>

目标模块 POM 的每个都包含以下部分:

  <build>
        <plugins>
            <plugin>
                <groupId>org.pitest</groupId>
                <artifactId>pitest-maven</artifactId>
            </plugin>
        </plugins>
    </build>

最后报告模块 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>

    <parent>
         ...
    </parent>

    <artifactId>mutationtesting</artifactId>

    <dependencies>
        <dependency>
            target module 1
        </dependency>

        <dependency>
            target module 2
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.pitest</groupId>
                <artifactId>pitest-maven</artifactId>
                <executions>
                    <execution>
                        <id>put-it-together</id>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
4

0 回答 0