You can do darn near anything you want in an ant script.
I don't know if there are any ready-made Ant Task modules that do that, but if not, it's very easy to write your own Ant Task definition. They're basically just javabeans.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.