ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Anson <>
Subject Re: failonerror; general solution
Date Fri, 10 Oct 2003 06:19:50 GMT
This has been a long thread, obviously it strikes a pain point. Here's a
few more observations from the peanut gallery:

Using <if> and <else> as general control tasks solves the problem of a
target's "if" and "unless" attributes only checking for property
existence rather than value. They also help structure the build files in
a more logical way. Whether this is the 'Ant way of doing things' or
not, this is still true and often times very useful.

Using <trycatch> gives the build system the same robustness that the
try/catch/finally construct gives to the Java language. It makes for
better build files by providing better error handling, as well as
providing a consistent way to handle 'failonerror' issues. Again,
whether this is the 'Ant way of doing things' or not, this is still true
and often times very useful. It would be much cleaner and consistent if
all tasks simply threw a build exception on error and <trycatch> became
the error handling mechanism.

I agree with the comment that modifying <sequential> to handle the
try/catch use cases (and not even handle it as well) is not the right

I don't think the entirety of ant-contrib should be merged into the core
tasks. I'd definitely vote for <trycatch> and <if>/<else>. Ant's
built-in support for pluggable tasks and libraries of tasks is more than
adequate for the more esoteric tasks that people might need. If they are
to the point where they know they need more than the core, then they
probably know there are lots of external tasks available and can learn
how to use them.


Samuel Gabriel wrote:
> An if and else attributes for each task would be something very helpful, I
> found many many occasions where I have to create a target just for one task
> that needs to be executed conditionally. 
> I was thinking somewhere along the lines of putting this attribute in the
> base Ant Task and so every task no matter what can have this feature which
> is absolutely helpful.
> -----Original Message-----
> From: [] 
> Sent: Thursday, October 09, 2003 3:41 PM
> To: Ant Developers List
> Subject: Re: failonerror; general solution
> Gus Heck wrote:
>>Im wondering if part of what is happening is a migration of what people
>>need from a build tool...
> Hi Gus ...
> I think what's happening is that people are building larger projects than
> most people who develop for Apache Ant had dealt with early in Ant history.
> I'm working on the build for a large Java project, 3939 lines of Ant XML.
> We have all sorts of configurations for the built product.
> Sitting there and writing two targets, one if="blah, one unless="blah",
> and putting both in the dependencies for the init target ... that can get
> old after only
> a few config variables!
>>If so, should ant change?
> Yes. As I said two years ago on this list, Ant (like m4, like make) is sort
> of a mini-Prolog,
> and Prolog *changed*. Like Edmund Burke's famous advice to King George III
> on the Stamp
> Act, the Prologians recognized that while everything *could* be solved
> purely by logic it was not
> always *convenient* to solve everything purely by logic. So Prolog added
> some control flow and
> iteration.
> Ant-contrib is a step in the right direction, only not quite far enough. I'd
> like to see IfElse with
> tasks as well as targets.
> --
> Jack J. Woehr            # "[F]ar in the empty sky a solitary esophagus
> slept
> #  upon motionless wing; everywhere brooded
> stillness,
> #  serenity, and the peace of God." - Mark Twain
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message