配置hudson maven作业以在出现测试失败时继续构建,但仅在没有测试失败时进行部署 [英] Configure a hudson maven job to keep building if there are test failures, but only deploy if there are no test failures

查看:80
本文介绍了配置hudson maven作业以在出现测试失败时继续构建,但仅在没有测试失败时进行部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为具有5个模块的maven多项目创建了一个hudson作业,以将SNAPSHOT工件部署到maven存储库.没关系,只要它成功构建且没有测试失败即可.但是,现在我想满足以下要求:

I've created a hudson job for our maven multi-project with 5 modules to deploy the SNAPSHOT artifacts to the maven repository. That's ok, as long as it builds successfully without test failures. However, now I'd like to fulfill the following requirements:

  • 当模块发生测试故障时,构建应继续扩建并测试其他模块,但变为黄色.使用-Dmaven.test.failure.ignore=true可以完成,但是在下一个要求时失败.
  • 当模块发生测试故障时,不应将任何工件部署到Maven存储库.其他项目取决于此项目的快照,而这些项目仅想使用最新版本没有任何失败测试的快照.
  • 最好使用hudson maven集成,而不是使用免费脚本,我们会获得hudson报告页面(每个模块的红色/黄色/蓝色状态,构建日志错误颜色,...).专门运行两次maven构建(第一个mvn test -Dmaven.test.failure.ignore=true而不是mvn deploy -DskipTests)不是解决方案,因为这会降低性能,并且混淆hudson报告页面,而且不是原子性的(它会在第二个构建中再次从存储库更新).
  • When a module has a test failure, the build should continue bulding and test the other modules, but turn yellow. Using -Dmaven.test.failure.ignore=true accomplishes, but fails at the next requirement.
  • When a module has a test failure, none of the artifacts should be deployed to the maven repository. Other projects depend on the snapshots this project and those projects only want to use the latest snapshots that don't have any failing tests.
  • Preferably, use the hudson maven integration instead of a free script we get the hudson report pages (red/yellow/blue status per module, build log error coloring, ...). Specifically running the maven build twice (first mvn test -Dmaven.test.failure.ignore=true, than mvn deploy -DskipTests) is not a solution because it's a performance loss and it confuses the hudson report pages and it's not atomic (it updates from the repositories again in the second build).

有什么办法可以做到这一点?

Is there any way to accomplish this?

推荐答案

有一个称为将工件部署到Maven存储库的后期构建选项.如果即使构建不稳定,也不会选择 Deploy ,那么这意味着如果测试失败,它将不会进行任何部署.与命令中的-fae一起,事情应该以您期望的方式工作

There is an post build option called Deploy artifacts to Maven repository. If you do not select Deploy even if the build is unstable, then that mean if test fails, it won't deploy anything. Together with the -fae in the command, thing should work in your desired way

这篇关于配置hudson maven作业以在出现测试失败时继续构建,但仅在没有测试失败时进行部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆