Mike Morris wrote:
I have an external task defined with a taskdef along the lines of:

<taskdef name="foo"
    classname="org.foobar.ant.FooTask"
    classpathref="build.classpath"
/>

The jarfile containing this task is in ${ant.home}/lib.
So far, so good.

Actually No. Since the Task is in $ANT_HOME/lib the Tas class will be loaded by the system loader (since all jars in ANT_HOME/lib are added to the classpath prior to starting Ant). Since this class is loaded by the taskdef's loader's parent, it cannot see classes available in the child loader.

Try moving FooTask's jar out of ANT_HOME/lib and then creating a new classpath containing the new loacation and the build.classpath. Use this new path in the taskdef

Could some kind soul please point me at where to find out more about how to use the loaderRef to ensure that all classes are being loaded by the same classloader, or some other way to resolve/workaround this issue.

loaderrefs are there to ensure that multiple taskdefs/typedefs use the same class loader which is not an issue for you since you are only doing one taskdef.


Conor



--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to