tags:

views:

11

answers:

0

This is a repeat of a question I posted on the Ant mailing list. However I haven't as yet had any replies.

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" xmlns:bar="org.bar">
  <target name="build">
    <typedef resource="bar.xml" uri="org.bar"/>

     <bar:CoolTask />
  </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.