开发者

Configure a hudson maven job to keep building if there are test failures, but only deploy if there are no test failures

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:

  • 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开发者_如何学Go 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?


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


maybe you can try use mvn -fae option with you jobs on hudson - it make maven fail only after full build


If build time isn't a problem for you, I think the better option is to create another job, just for deploying. Something like this:

  1. Configure your original job (let's call it "build job") with "mvn -fae clean install"
  2. Create a new job ("deploy job") with "mvn deploy", and don't configure any Build triggers for it
  3. In the "build job", enable the Build other projects option, under Post-build actions and set it to run your "deploy job".

Maybe you can try to configure both jobs to use the same workspace, saving some time on the whole build/deploy process.


If you happen to use Artifactory as a repository manager, you can use the Hudson/Jenkins Artifactory plugin to deploy your artifacts. This plugin will only deploy your artifacts if all tests pass for all modules of a Maven build.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜