我正在尝试使用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
在 詹金斯 建造时的位置:
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] ------------------------------------------------------------------------
生成状态表明所有模块和父级都是 成功的 ,实际上,这些应该是失败的。
我如何像詹姆斯在命令行中那样让詹金斯在maven构建中强制执行快速失败?
提前致谢。
Jenkins默认情况下会忽略测试失败,然后将构建标记为不稳定(如果存在)。
控制该参数的参数是:testFailureIgnore(请参见surefire插件文档)
我从未尝试过,但是我会尝试在jenkins作业配置上覆盖该设置:
-Dmaven.test.failure.ignore = false