What's the difference between -DskipTests and -Dmaven.test.skip=true

Maven docs:

-DskipTests compiles the tests, but skips running them

-Dmaven.test.skip=true skips compiling the tests and does not run them

Also this one might be important

maven.test.skip is honored by Surefire, Failsafe and the Compiler Plugin


There is a third, related option described here: https://stackoverflow.com/a/21933970/3169948

"maven.test.skip.exec=true" the tests get compiled, but not executed.

So the complete set of test options for Maven would be:

  • -DskipTests ==> the tests get compiled, but not executed.
  • -Dmaven.test.skip.exec=true ==> the tests get compiled, but not executed (exactly the same as -DskipTests).
  • -Dmaven.test.skip=true ==> doesn't compile or execute the tests.