java -DskipTests 和 -Dmaven.test.skip=true 有什么区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25639336/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 08:22:22  来源:igfitidea点击:

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

javamavenhive

提问by Stanley Shi

I was trying to build hive-0.13.

我试图构建 hive-0.13。

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

使用时-Dmaven.test.skip=true,它不会构建测试 jar,但会检查测试依赖项。

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

使用时-DskipTests,它不会构建测试 jars,也不会检查测试依赖项。

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

什么之间的区别-DskipTests-Dmaven.test.skip=true

回答by Kamil K?ys

Maven docs:

Maven 文档

-DskipTestscompiles the tests, but skips running them

-DskipTests编译测试,但跳过运行它们

-Dmaven.test.skip=trueskips compiling the tests anddoes not run them

-Dmaven.test.skip=true跳过编译测试并且不运行它们

Also this one might be important

这个也可能很重要

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

maven.test.skip 受到 Surefire、Failsafe 和编译器插件的认可

回答by CorbaTheGeek

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

这里描述了第三个相关选项:https: //stackoverflow.com/a/21933970/3169948

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

"maven.test.skip.exec=true" 测试被编译,但不执行。

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

因此,Maven 的完整测试选项集将是:

  • -DskipTests ==> compiles the tests, but skips running them
  • -Dmaven.test.skip.exec=true ==> the tests get compiled, but not executed.
  • -Dmaven.test.skip=true ==> doesn't compile or execute the tests.
  • -DskipTests ==> 编译测试,但跳过运行它们
  • -Dmaven.test.skip.exec=true ==> 测试被编译,但未执行。
  • -Dmaven.test.skip=true ==> 不编译或执行测试。