Is there something like finalizedBy that doesn't run if the task fails?

Assuming that my jar task succeeds, I want to then run an ant post-processing task. This ant post-processing task is shared by many tasks, so it doesn’t seem like dependsOn is the answer.

finalizedBy does what I want, except it runs the ant task even if the jar task fails. What is the best way to call task B after task A finishes, but only if task A succeeds?