Java 我们可以从失败的地方开始构建 Maven 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2902322/
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
Can we start the maven build from the point where it failed
提问by Shekhar
Suppose, I am doing a full build on my large project which has 7 modules and on the 6th module, the build failed because a test failed. Is there any way by which I can start the build from the point it failed?
假设,我正在对包含 7 个模块的大型项目进行完整构建,而在第 6 个模块上,由于测试失败,构建失败。有什么方法可以让我从失败的地方开始构建?
采纳答案by Pascal Thivent
You can resume the build from the 6th module using -rf
or --resume-from
:
您可以使用-rf
或从第 6 个模块恢复构建--resume-from
:
-rf, --resume-from
Resume reactor from specified project
-rf, --resume-from
从指定项目恢复反应堆
See the Advanced Reactor Optionsfor details.
有关详细信息,请参阅高级反应器选项。
回答by fish
You could run the build of module 6 separately to see if it still fails, but I'm afraid that you need to build all modules from the beginning when you want to run the "big" build.
您可以单独运行模块 6 的构建以查看它是否仍然失败,但是当您想要运行“大”构建时,恐怕您需要从头开始构建所有模块。
Edit: Of course the subsequent builds will be faster because the code of modules 1-5 are already compiled, unless you run clean as part of your build.
编辑:当然,后续构建会更快,因为模块 1-5 的代码已经编译,除非您在构建过程中运行 clean。
回答by user3401235
you can resume the build from any module you want by using the -rf
command.
For example, if your build failed in myproject-proxy, you can use the following command:
您可以使用该-rf
命令从您想要的任何模块恢复构建。例如,如果您在 myproject-proxy 中构建失败,您可以使用以下命令:
mvn -rf myproject-proxy clean install
回答by Antonio Martin
look at the maven summary and you will see the executed modules and where maven is stopped. then try this:
查看 maven 摘要,您将看到执行的模块以及 maven 停止的位置。然后试试这个:
mvn clean install-Dmaven.test.skip=true -rf :yourModule
回答by M Sach
Here is the example
这是例子
mvn clean install -rf :your-module
回答by scott_dennis
Syntax: mvn -rf modulename mavengoal or mvn --remove-from modulename mavengoal
语法: mvn -rf modulename mavengoal 或 mvn --remove-from modulename mavengoal
Ex: mvn -rf admin-module clean install or mvn --remove-from admin-module clean install
例如: mvn -rf admin-module clean install 或 mvn --remove-from admin-module clean install