获取ant 打包的返回的code,然后根据code来处理逻辑
cd $PROJECT_PATH/ && ant -buildfile jenkins_build.xml war antReturnCode=$? echo "ANT: Return code is: ""$antReturnCode""" if [ $antReturnCode -ne 0 ];then echo "ant deploy failed!" exit 1; else echo "ant deploy success!" fi