Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot overwrite pom maven-surefire-plugin from command line

I have in pom the plugin maven-surefire-plugin with skipTests on true. However, sometimes I want to run the tests from the command line and I want to overwrite this plugin from command line and to leave the pom file unchanged.

I tried

mvn install -DskipTests=false
but it still skips the tests...

Any idea how I can solve my problem...?
Thanks

like image 689
Roxana Avatar asked Nov 17 '25 16:11

Roxana


1 Answers

Skipping by default is specifically discussed in the plugin documentation:

If you want to skip tests by default but want the ability to re-enable tests from the command line, you need to go via a properties section in the pom

In other words use a property for the default:

    <configuration>
      <skipTests>${skipTests}</skipTests>
    </configuration>

Define a property:

    <properties>
      <skipTests>true</skipTests>
    </properties>

Properties can be overridden from the command-line:

    mvn install -DskipTests=false

Note that the skipTests in the command-line above refers to the property, not to the plugin parameter with the same name.

like image 76
Sander Verhagen Avatar answered Nov 20 '25 07:11

Sander Verhagen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!