Reputation: 8444
If I have a set of commands in a <target>
in my build.xml file, is there a way to stop ant from executing the next command if the previous one returned an exit code of -1? Is it standard ant behavior to exit when a command fails or to keep going despite a bad exit code?
Upvotes: 0
Views: 3862
Reputation: 137
When you set failonerror="true", the only possible value for resultproperty is 0. Any non-zero response is treated as an error and would mean the build exits.
Upvotes: 0
Reputation: 2739
<exec>
task has failonerror
to make the task to stop the build when the external command exits with an return code indicating error.
It also has resultproperty
to save the return code to a property so that you can do more conditional checking later. However, it's only of interest when failonerror
isn't set to true
.
See <exec>
task's manual: http://ant.apache.org/manual/Tasks/exec.html
Upvotes: 2