ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <>
Subject Re: Custom ant task and resources
Date Thu, 27 Oct 2005 23:11:55 GMT
Johannes Rieken wrote:

>Hi everyone!
>I 've written a custom ant task which I deploy as a jar file. This jar file 
>contains another jar file which is read during task execution. 
>I'm using the static method "ClassLoader.getSystemResource(String):URL" to 
>access resources in jar file which usually works fine. 
>However calling it form my ant task doesn't work. (null is returned, although 
>the resource exists and the path is correct)
>Does anyone know what I am doing wrong? I've tried 
>"MyTask.class.getResource(String):URL" but had no success.
Hello Johannes,

you are not doing anything wrong, but the jar file which is included
(nested) into the jar containing the task will not be loaded by the
AntClassLoader. This class loader only loads jars or zips existing
on the filesystem, but cannot at the moment add to the class path a zip
entry which happens to be a jar.

So you would need to present the nested jar separately in the filesystem
and put it in the classpath.

Maybe other committers would know of better solutions though. :-)

>Cheers, Johannes


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message