I have an Ant target that executes 2 steps in sequence:
<target name="release">
<antcall target="-compile"/>
<antcall target="-post-compile"/>
</target>
With the above script, it quits immediately if the "-compile" target fails. "-post-compile" does not get a chance to run. Is there a way to make sure the second step (-post-compile) is executed even if the 1st one (-compile) fails?
I think you are looking for
-keep-going (-k)
This will tell Ant to continue building all targets which do not depend on the failed target.
If you are using ant-contrib (which is very common), you could make use of the try-catch task and put your
post-compile
call into itsfinally
element.Also, if you are not using ant-contrib, then you might use the subant task to call your
compile
target.subant
has afailonerror
attribute, which you can use to individually ignore failed targets. Lots of usage examples on the task description page.