ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Anson <dan...@grafidog.com>
Subject Re: Custom ant task and resources
Date Fri, 28 Oct 2005 14:49:10 GMT
Johannes,

I've written a classloader that handles that specific situation. You can 
view the source at:

http://antelope.tigris.org/source/browse/antelope/src/ise/antelope/launcher/SubJarClassLoader.java?rev=1.1&view=markup

This code is distributed with Antelope, the source is available at 
http://antelope.tigris.org.

Hope this helps!

Dale



Antoine Levy-Lambert wrote:

>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
>>
>>
>> 
>>
>>    
>>
>
>Antoine
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>  
>

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


Mime
View raw message