Execution pit-mutation of goal org.pitest:pitest-maven failed

·

2 min read

Table of contents

Problem

Execution pit-mutation of goal org.pitest:pitest-maven:1.8.0:mutationCoverage failed: Please check you have correctly installed the pitest plugin for your project's test library (JUnit 5, TestNG, JUnit 4 etc). 
[ERROR] 
[ERROR] Please copy and paste the information and the complete stacktrace below when reporting an issue
[ERROR] VM : OpenJDK 64-Bit Server VM
[ERROR] Vendor : Amazon.com Inc.
[ERROR] Version : 11.0.14.1+10-LTS
[ERROR] Uptime : 2967
[ERROR] Input -> 
[ERROR]  1 : -Dclassworlds.conf=/usr/share/maven/bin/m2.conf
[ERROR]  2 : -Dmaven.home=/usr/share/maven
[ERROR]  3 : -Dlibrary.jansi.path=/usr/share/maven/lib/jansi-native
[ERROR]  4 : -Dmaven.multiModuleProjectDirectory=/home/adafycheng/Projects/fav-car-colour-app
[ERROR] BootClassPathSupported : false
[ERROR] 
[ERROR] 
[ERROR] Please copy and paste the information and the complete stacktrace below when reporting an issue
[ERROR] VM : OpenJDK 64-Bit Server VM
[ERROR] Vendor : Amazon.com Inc.
[ERROR] Version : 11.0.14.1+10-LTS
[ERROR] Uptime : 2967
[ERROR] Input -> 
[ERROR]  1 : -Dclassworlds.conf=/usr/share/maven/bin/m2.conf
[ERROR]  2 : -Dmaven.home=/usr/share/maven
[ERROR]  3 : -Dlibrary.jansi.path=/usr/share/maven/lib/jansi-native
[ERROR]  4 : -Dmaven.multiModuleProjectDirectory=/home/adafycheng/Projects/fav-car-colour-app
[ERROR] BootClassPathSupported : false
[ERROR] 
[ERROR] -> [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.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Root cause

According to a reported issue, an additional dependency is required for Junit5 test cases.

Solution

Add a dependency in pom.xml:

<!-- https://github.com/hcoles/pitest/issues/284 -->
<!-- Need this to support JUnit 5 for the PIT test plugin-->
<dependency>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-junit5-plugin</artifactId>
    <version>0.15</version>
</dependency>