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 failure 1. Can anyone tell me how can this be achieved?
Asked
Active
Viewed 9,646 times
1 Answers
3
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

Jacob
- 41,721
- 6
- 79
- 81
-
Is ant installed correctly? What is shown when you enter `ant` in the command line? – Jacob Jul 21 '11 at 13:44