我正在尝试使用 Jenkins 构建一个多模块 Maven 项目。
当我使用与 Jenkins相同的环境(variables/settings.xml/user)在命令行上构建相同的项目时,测试失败会导致构建立即失败:
Failed tests:
testSomething(com.package_name.TestSomethingOrTheOther)
Tests run: .., Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
...
# Build fails immediately
在Jenkins中构建时:
Failed tests:
testSomething(com.package_name.TestSomethingOrTheOther)
Tests run: .., Failures: 1, Errors: 0, Skipped: 0
[ERROR] There are test failures.
...
# Build continues to other modules
...
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] parent ................................................ SUCCESS [.....s]
[INFO] module-that-failed .................................... SUCCESS [.....s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
该构建声明所有模块和父模块都是成功的,而实际上,这些应该是失败的。
如何让 Jenkins 在 Maven 构建中强制执行快速失败,就像 Maven 在命令行中所做的那样?
提前致谢。