ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <>
Subject Re: NameSpace & antlib was (Re: polymorphism)
Date Mon, 28 Apr 2003 17:54:57 GMT

peter reilly wrote, On 28/04/2003 19.53:
> On Monday 28 April 2003 18:41, Nicola Ken Barozzi wrote:
>>peter reilly wrote, On 28/04/2003 19.37:
>>>On Sunday 27 April 2003 22:14, Wannheden, Knut wrote:
>>>>but maybe the buildfile author wants/needs to specify the namespace URI
>>>>(anything really), in which case an additional "ns" attribute could be
>>>>	<antlib resource="${foo.jar}" ns="urn:antlib:foo"/>
>>>>	<foo:bar xmlns:foo="urn:antlib:foo"/>
>>>This is fine.
>>><antlib file="${ant-contrib.jar}" ns="antlib:antcontrib"/>
>>><antcontrib:if xmlns:antcontrib ="antlib:antcontrib"....>
>>><target xmlns:antcontrib="antlib:antcontrib" name="compile">
>>>   <antcontrib:propertycopy .../>
>>This is *veeeeery* ugly. I like that Ant buildfiles are reasonably
>>readable, and would like to have it maintained if possible.
> True. It seems quite difficult to use namespaces in a nice way.
> The niceest I can thing of is to place all the jars in
> ${ant.home}/lib and set the namespace up in the project declation:
> <project xmlns:antcontrib="antlib:${ant.home}/lib/ant-contrib.jar"
>              xmlns:antcontrib="antlib:${ant.home}/lib/antleope.jar">

Well, defining a namespace does not assume that it's attached to a 
meaning, so I could define it in the project declaration but only "load" 
the task it's attached to later.

<project xmlns:antcontrib="net/sf/antcontrib">

     <!-- ant-contrib.jar knows that it binds to "net/sf/antcontrib" -->
     <antlib file="${ant-contrib.jar}"/>

Nicola Ken Barozzi         
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)

View raw message