views:

74

answers:

1

I have many targets in my build.xml for Ant. Generally I am running two via a shell script, one to construct the application and one for cleaning up. The shell script checks the exit status of the construction to see if it should clean up or leave the clutter behind so I can determine what went wrong and fix it.

So went all is going well, the majority of the time, Ant is executed once for construction and once for clean up. This results in my build.number being incremented for each execution. So in steady state, my build.number increments by 2.

How can a tell Ant to not increment the build.number? I would do this for clean up as I haven't built anything.

I know the obvious answer of creating a separate script for clean up only, but I'd rather keep the entire build.xml in one file.

A: 

Why not define one target (the complete) build as being dependent on a compilation target and a cleanup target ? That way Ant only has to execute once, and if it bails out it won't execute the cleanup task.

Brian Agnew
I was afraid it might be something so obvious.
dacracot