ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shackelford, John-Mason" <>
Subject patterns conditionals/macrodef
Date Wed, 02 Jun 2004 17:25:44 GMT
I have tried to be a purist and avoid the antcontrib if task, but it doesn't
appear to be possible to make effective use of macrodef without it. I was
looking forward to using macrodef to help me solve the classic problem
wherein one wants to reuse an ant snippet in two different targets, and in
one target the snippet requires some action first, whereas in the second
target the action isn't required at all. 

<target name="build" depends="init,clean">
    <!-- macrodef calls -->
   <build-jar-deps />
   <build-jar-no-deps />

<target name="build-no-deps" depends="init,clean">
    <!-- macrodef calls -->
    <build-jar-no-deps />

As soon as a condition is required in one of the macrodefs, the whole thing
falls apart. If I tear out the macrodefs and replace them with targets so
that I can get the if/unless attributes, I have no alternative but to use
antcall again, yuck!

Have the committers have found a pattern which allows them to avoid this
situation? If not, of the two evils which should I regard as the greater:
the if task, or the antcall? Is there a solution for this catch-22 on the

John-Mason Shackelford

Software Developer
Pearson Educational Measurement - eMeasurement Group

2510 North Dodge St.
Iowa City, IA 52245
ph. 319-354-9200x6214

This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 

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

View raw message