Suppose I have some Ant task – say javac or junit – if either task fails, I want to execute a task, but if they succeed I don’t.
Any idea how to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In your junit target, for example, you can set the
failureProperty:Then, create a target that only runs if the
test.failedproperty is set, but fails at the end:Finally, tie them together:
Then just call the
testtarget to run your JUnit tests. Thejunittarget will run. If it fails (failure or error) thetest.failedproperty will be set, and the body of theotherStufftarget will execute.The javac task supports
failonerroranderrorPropertyattributes, which can be used to get similar behavior.