开发者

How to run ant script from a shell script?

开发者 https://www.devze.com 2023-03-21 02:25 出处:网络
I need to run an ant script from a shell script and if the ant script is executed successfully I must get the return code 0 or in case of fai开发者_C百科lure 1. Can anyone tell me how can this be achi

I need to run an ant script from a shell script and if the ant script is executed successfully I must get the return code 0 or in case of fai开发者_C百科lure 1. Can anyone tell me how can this be achieved?


cd ~/yoursourcedir/
ant
if [[ $? -ne 0 ]]
then
    echo "error happend"
fi

$? contains the error code of your last command, in this case ant. -ne 0 means not equal 0, so if any error happened, execute the echo.

You can specify the standard paramters to ant, i.e. your buildfile:

ant -buildfile build.xml

Summary of ant run options

0

精彩评论

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

关注公众号