我正在处理一个 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/