You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kieran Simpson <ki...@gmail.com> on 2010/10/08 08:30:33 UTC

Binding of typedefs to namespaces recursively

I have an Antlib foo.xml that contains

<antlib>
  <macrodef name="AwesomeTask" />
</antlib>

I have another Antlib bar.xml that uses foo.xml like so

<antlib xmlns:foo="org.foo">
  <typedef uri="org.foo" resource="foo.xml" />

  <macrodef name="CoolTask">
    <foo:AwesomeTask" />
  </macrodef>
</antlib>

I have a build file that uses bar.xml

<project name="my.build">
  <target name="build">
    <typedef resource="bar.xml" uri="org.bar"/>
  </target>
</project>

When I run the build, I get the error that foo:AwesomeTask is
undefined.  Running with verbose on I get:

 [macrodef] creating macro  org.bar:AwesomeTask
 [macrodef] creating macro  org.bar:CoolTask

It seems as if the binding of tasks in foo.xml to "org.foo" is
overridden by the binding of bar.xml to "org.bar".

To increase reuse/modularity across my projects I wanted to have
Antlibs that can use other Antlibs.  Maybe I'm abusing the Antlib
idea.

Regards,
Kieran S

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Binding of typedefs to namespaces recursively

Posted by Kieran Simpson <ki...@gmail.com>.
I inaccurately gave the second project definition.  It should be:

<project name="my.build" xmlns:bar="org.bar">
  <target name="build">
    <typedef resource="bar.xml" uri="org.bar"/>

     <bar:CoolTask />
  </target>
</project>

I'm still having no luck figuring this out, so better to correct myself, in case it helps.

I'm also using Ant 1.8.1

Regards,
Kieran S


On 01/-9/37 05:59, Kieran Simpson wrote:
> I have an Antlib foo.xml that contains
>
> <antlib>
>   <macrodef name="AwesomeTask" />
> </antlib>
>
> I have another Antlib bar.xml that uses foo.xml like so
>
> <antlib xmlns:foo="org.foo">
>   <typedef uri="org.foo" resource="foo.xml" />
>
>   <macrodef name="CoolTask">
>     <foo:AwesomeTask" />
>   </macrodef>
> </antlib>
>
> I have a build file that uses bar.xml
>
> <project name="my.build">
>   <target name="build">
>     <typedef resource="bar.xml" uri="org.bar"/>
>   </target>
> </project>
>
> When I run the build, I get the error that foo:AwesomeTask is
> undefined.  Running with verbose on I get:
>
>  [macrodef] creating macro  org.bar:AwesomeTask
>  [macrodef] creating macro  org.bar:CoolTask
>
> It seems as if the binding of tasks in foo.xml to "org.foo" is
> overridden by the binding of bar.xml to "org.bar".
>
> To increase reuse/modularity across my projects I wanted to have
> Antlibs that can use other Antlibs.  Maybe I'm abusing the Antlib
> idea.
>
> Regards,
> Kieran S

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org