maven - 使用 Maven react 器时如何跳过测试?

标签 maven testing maven-reactor

我正在处理一个 Maven 多模块项目。我想构建一个给定的模块并跳过单元测试以加快构建过程。

我试过以下方法:

mvn reactor:make -Dmake.folders=search -Dgoals=package,-DskipTests

mvn reactor:make -Dmake.folders=search -Dgoals=package -Dmaven.test.skip=True

然而,这根本没有效果。有什么线索吗?

最佳答案

你的第一行看起来是正确的想法,但你应该使用 -Dmake.goals 而不是 -Dgoals

来自reactor plugin examples page :

The reactor plugin launches a second copy of Maven to do its magic. This copy of Maven doesn't necessarily have all of the flags and options that you passed to your first copy of Maven, including the --debug flag, system properties, and -DskipTests.

You can pass additional arguments to the spawned Maven by treating them as goals with -Dmake.goals, like this:

mvn reactor:resume -Dmake.folders=barBusinessLogic -Dmake.goals=install,-DskipTests

In other words, the "goals" are just extra command-line parameters passed to the spawned Maven; they don't necessarily have to be "goals."

If you want to get really fancy, you may prefer to just dry run the reactor plugin in -Dmake.printOnly mode, described above. That will print out the command that the plugin would have used to build, but you can tweak that command line to your heart's content!

关于maven - 使用 Maven react 器时如何跳过测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4244372/

相关文章:

maven依赖未下载

javascript - jQuery/JavaScript : Autopopulate Dynamically Populated Elements

java - 在 JUnit 中检查异常的最佳实践是什么?

Maven - 跳过父项目构建

eclipse - 如何在 tycho eclipse-repository 的 category.xml 中正确指定 eclipse-plugins?

java - 如何将 log4j 与 Maven 和可执行 jar 文件一起使用?

java - 如何将mockito与maven测试工具一起使用

nunit - 最小起订量问题 - 模拟类返回不正确的数据

spring - Maven react 器: pom using Spring boot starter pom