Skip running PITest in maven build

I’m trying to run a maven build from command line and exclude PITest from running any mutations. Currently the reports are failing and we need to be able to give a parameter to ignore running the mutation tests or ignore the results and continue the build

I’ve running with some parameters like mvn package

or mvn package

This is the PITest setup in my pom


The problem is that is is still running PITest and causing the build to fail


There is no native way of skipping a plugin execution, but there are least 2 workarounds:

  • First, is adding a property to override execution phase:

Define a property pitPhase with default value as the default phase of plugin execution.

Then in plugin configuration:


After that, when you want to skip execution mvn -DskipPit=pitPhase package

  • The other alternative is to add a Maven profile with the plugin execution

Leave a Reply

Your email address will not be published. Required fields are marked *