如何通过一个bash脚本检测从蚂蚁/ Maven的构建错误? [英] how to detect a build error from ant/maven via a bash script?

查看:235
本文介绍了如何通过一个bash脚本检测从蚂蚁/ Maven的构建错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个bash脚本来自动生成过程。有两个主要构建块,一个是蚂蚁任务,一个是普通的老MVN全新安装。我想,当有建立自己的错误无论从这两构建过程来做些什么。

和问题是,这些构建将含有测试失败或错误不时,但最终的结果是成功的。我相信这些进程的状态code($?)回应该是0,无论构建失败或成功,我可能是错的。

那么,什么是我的脚本来检测最终结果的最佳方式(建设失败/成功),而从他们中间构建过程中捕捉假信息(检测到的错误,等等)?


解决方案

  MVN干净的测试
RC = $?
如果[[$ RC -ne 0];然后
  echo'不能执行测试';退出$ RC
科幻

i'm writing a bash script to automate the build process. there are two major build blocks, one is an ant task and one is a plain old "mvn clean install". i want to do something when there are build error coming from either of this two build processes.

and the problem is, these builds will contain test failures or errors from time to time, but the end result is successful. and i believe that the status code ($?) return by these processes should be 0 no matter the build fail or succeed, i could be wrong.

so what is the best way for my script to detect the end result (build fail/succeed) without catching the false info during the mid build (test errors, etc) from them?

解决方案

mvn clean test
rc=$?
if [[ $rc -ne 0 ]] ; then
  echo 'could not perform tests'; exit $rc
fi

这篇关于如何通过一个bash脚本检测从蚂蚁/ Maven的构建错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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