You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Pepijn Van Eeckhoudt <pe...@luciad.com> on 2009/11/30 09:16:24 UTC

Transitive ant lib loading

Hi,

In my build script I'm downloading a bunch of antlib jars to a specific
directory using Ivy. I then try to load those downloaded antlibs with a
taskdef but for some reason transitive dependencies are not working.
I've reduced this to a simple test case:
Using the following directory layout (file contents below)
build.xml
lib
   antlib1
     antlib.xml
   antlib2
     antlib.xml

I'm loading antlib1 from build.xml using
'xmlns:antlib1="antlib:antlib1"' and 'taskdef antlib="antlib:antlib1"
classpath="lib"'. antlib1 uses antlib2 and simply declares an xmlns for
this.

Loading antlib1 from build.xml works correctly, but when antlib1 tries
to load antlib2 it seems to have lost track of the classpath/classloader
that I used to load antlib1. Instead Ant reports that antlib2 could not
be found. I've been able to achieve what I'm trying to do with a custom
'antlibdef' task that does what I expect, but I was wondering now if
this should work with plain Ant in the first place or not.

Am I missing something obvious or is it expected that this does not work?

Regards,

Pepijn Van Eeckhoudt


build.xml:
<project basedir="." name="test" xmlns:antlib1="antlib:antlib1">
   <taskdef antlib="antlib:antlib1" classpath="lib"/>

   <target name="test">
     <antlib1:foo/>
   </target>
</project>

antlib1/antlib.xml:
<antlib xmlns:antlib2="antlib:antlib2">
     <macrodef name="foo">
         <sequential>
             <echo>Hello from antlib1</echo>
             <antlib2:bar/>
         </sequential>
     </macrodef>
</antlib>

antlib2/antlib.xml:
<antlib>
     <macrodef name="bar">
         <sequential>
             <echo>Hello from antlib2</echo>
         </sequential>
     </macrodef>
</antlib>
-- 
Pepijn Van Eeckhoudt - Project Leader
T +32 16 23 95 91
F +32 16 29 34 22 | pepijn.vaneeckhoudt@luciad.com

LUCIAD - high performance visualization
Wetenschapspark Arenberg | Gaston Geenslaan 9
3001 Leuven | Belgium | www.luciad.com



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