ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: [Ant 1.6beta1] More feedback about import
Date Fri, 17 Oct 2003 13:51:16 GMT
> From: peter reilly []
> > As far as the problem you describe above, this is exactly why I argued
> > against this un-intuitive de-referencing of properties in <macrodef> so
> > vehemently...
> Mmm..
> not quite, the problem is due to the available file attribute being a File
> and the import file attribute being a String and interperted differently.

Ah ;-)

> The correct solution is to use <trycatch>, but this is noisy - it needs
> a quiet attribute to suppress the "Caught exception" message.
>   <macrodef name="conditional-import">
>     <attribute name="file"/>
>     <sequential>
>       <ac:trycatch quiet="yes">
>         <try>
>           <import file="${file}"/>
>         </try>
>         <catch/>
>       </ac:trycatch>
>     </sequential>
>   </macrodef>

Adding an attribute to <import> (like you did) is tons better than that.

> > OK, but beside that, what would happen if the <macrodef> was in my
> > antlib.xml. I am rather confused about what *should* happen.
> In this case what should work does not (grrr).
> The import task resolves a relative file attribute from the antlib file
> and not the file that contains the conditional-import task.
> The problem, is that the macro does not set the location
> attribute of the tasks it runs.
> If it sets them, some error messages would make less sense than they
> do at the moment (and some more).
> However, the it is most likely more correct to set the location.

Frankly, I'm not sure I followed all the reasoning... It all sounds too
complex for my liking, so I'll just enjoy the new 'optional' attribute of
<import>, and forget the subtleties of a <macrodef> inside an Antlib.xml for
a conditional <import>.

Thanks again, --DD

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

View raw message