2

I integrated Pitest according to https://pitest.org/aggregating_tests_across_modules/ in a Maven module project (Maven version 3.5.4).

When running mvn clean package the log shows the Pitest execution for the target modules (i.e. the modules for which Pitest should be executed) and I confirmed that result files are actually produced.

However, I get the following error message for the report module:

[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 is a dependency of the target modules and therefore a transitive dependency of the reporting module. It seems to me that the report-aggregate goal also tries to analyse the transitive dependencies of the modules for which Pitest is enabled.

Is there some error in the project configuration? Is this a known bug? What can I do?

I tried to change the scope of the target modules in the reporting module to provided, and I also set the packing of the reporting module to pom, but to no avail.

Configuration

I configured Pitest in the parent POM as follows:

        <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>

The target module POM's each contain this section:

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

And finally the reporting module POM looks like this

<?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>
Mark Schäfer
  • 925
  • 1
  • 12
  • 23
  • I'm having the same issue, but in my case it's not even an external transitive dependency that is being complained about - it's one of the submodules that is being mutation tested and that is a dependency of another. I can include the dependency module in the aggrate report with no issues, but including the module that depends on it throws this "jar is not a directory" failure – ryanm May 12 '21 at 07:17
  • https://github.com/hcoles/pitest/issues/621 seems relevant – ryanm May 12 '21 at 14:42

0 Answers0