63

I was trying to build hive-0.13.

When using -Dmaven.test.skip=true, it will not build the test jars but it will check test dependency.

When using -DskipTests, it will not build the test jars and also not check test dependency.

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

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Stanley Shi
  • 679
  • 1
  • 5
  • 9

2 Answers2

107

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

kaliatech
  • 17,579
  • 5
  • 72
  • 84
Kamil Kłys
  • 1,907
  • 3
  • 18
  • 30
  • Thanks, I also found this here: http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html – Stanley Shi Sep 03 '14 at 08:23
  • 2
    Stanley, in your comment, the correct url is http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.html – manavi May 04 '17 at 11:48
5

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.
AbdullahC
  • 6,649
  • 3
  • 27
  • 43
CorbaTheGeek
  • 71
  • 1
  • 4
  • 3
    The first two have the same effect, correct? In other words, "skips running" == "not executed", right? Does that also mean that both set the exact same properties etc., so are they really completely interchangeable? – MarnixKlooster ReinstateMonica Oct 02 '18 at 11:49