【发布时间】:2014-07-13 01:41:52
【问题描述】:
上下文:我想在多模块项目中编译和测试所有模块,但如果有任何失败编译或测试我希望整个构建失败。
默认配置要么在第一次失败时停止,要么在测试失败后跳过模块
跑步:
mvn 全新安装
在第一个失败的模块处停止。
如果你添加:
mvn clean install -fae //最后失败
然后运行所有模块,但如果测试失败,则跳过任何依赖模块:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Module A ............................................. SUCCESS [15.210s]
[INFO] Module B ............................................. SUCCESS [10.923s]
[INFO] Module C ............................................. FAILED [1.731s]
[INFO] Module D ............................................. SUCCESS [3.791s]
[INFO] Module E ............................................. SUCCESS [1.488s]
[INFO] Module F ............................................. SKIPPED (dependency build failed or was skipped)
[INFO] Module G ............................................. SKIPPED (dependency build failed or was skipped)
[INFO] Module H ............................................. SKIPPED (dependency build failed or was skipped)
[INFO] Module I ............................................. SUCCESS [1.690s]
[INFO] -----------------------------------------
另一个强制所有模块编译的选项是:
mvn clean install -fn //永远不会失败
但这会导致测试失败时构建通过
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Module A ............................................. SUCCESS [15.210s]
[INFO] Module B ............................................. SUCCESS [10.923s]
[INFO] Module C ............................................. FAILED [1.731s]
[INFO] Module D ............................................. SUCCESS [3.791s]
[INFO] Module E ............................................. SUCCESS [1.488s]
[INFO] Module F ............................................. SUCCESS [9.062s]
[INFO] Module G ............................................. SUCCESS [16.324s]
[INFO] Module H ............................................. SUCCESS [4.032s]
[INFO] Module I ............................................. SUCCESS [1.690s]
[INFO] ------------------------------------------------------------------------
[INFO] Error for project: Module C (during install)
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
Please refer to C:\MavenBuildDir\ModuleC\surefire-reports for the
individual test results.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] + Ignoring failures
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30 minutes 38 seconds
[INFO] Finished at: Fri May 23 16:42:08 BST 2014
[INFO] Final Memory: 39M/185M
谁能建议一组选项来实现以下目标:
- 编译所有模块
- 在所有模块上运行测试
- 如果模块的测试失败,但代码编译依赖的模块仍然得到编译和测试
非常感谢您的回复 - 否则,如果有多个问题,我们必须在构建服务器上重复运行测试 - 耗费大量时间。
【问题讨论】:
-
有什么更新吗?你是怎么解决这个问题的?
-
感谢您提出这个问题!这是我能找到的唯一真正显示
-fae影响构建的位置/方式的地方!没有任何文档说明-fae是否会影响编译失败。