ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject RE: Way for buildfile to verify that Ant version is 1.5.2 or grea ter ?
Date Fri, 22 Oct 2004 14:32:56 GMT
> From: Stefan Bodewig []
> On Fri, 22 Oct 2004, Jan Materne <> wrote:
> > A non usual way is checking for the existing of special classes.  So
> > you 'only' have to check which classes were added in a release and
> > you could check for them.
> It might help to have a concrete example ;-)
> <available property="Ant-1.5.2-or-later"
>            classname=""/>
> <fail message="You must use Ant 1.5.2 or later"
>       unless="Ant-1.5.2-or-later"/>

I've had similar issues in the past, and didn't find a good solution.
This is why I advocated to have a version attribute on <project>.

The problem is that if you have a script that uses Ant 1.6+ tasks
with new attributes compared to their equivalent in 1.5, the build will
never reach the <available>+<fail>. It will fail at parsing time,
before any task gets to execute. That's because Ant 1.5, unlike 1.6,
instantiate some tasks at parsing time, and others later on, while
Ant 1.6 does them all later on, the first time there's used.

Furthermore, Ant 1.5 does not allow arbitrary task at top level,
so the <available>+<fail> must be within a target, complicating
the logic of the script.

And Jan's <scriptdef> is Ant 1.6+ specific of course.

So no, there's no clean and safe way to do this, short of writing
your own main() for Ant, or implementing a custom ProjectHelper...
Ant should have had a version attribute long ago. --DD

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

View raw message