ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Mawson <jem.maw...@gmail.com>
Subject Re: Access to custom task's classpath?
Date Tue, 14 Oct 2008 10:28:50 GMT
Thank you Stefan, that helped a lot.

Jeremy


Stefan Bodewig wrote:
> On Mon, 13 Oct 2008, Jeremy Mawson <jem.mawson@gmail.com> wrote:
> 
>> I have a custom task defined thus:
>>
>> <taskdef resource="task.properties" classpathref="task.class.path"/>
>>
>> The classpathref contains the jar which includes both my Task and a
>> file resource. When I try to obtain the resource in the Task at
>> runtime I'm unable to find it.
> 
> You should be able to load it with MyTask.class.getResource().
> 
>> When I print out the java.class.path property in the task, it does
>> not include the jar my Task is in!
> 
> This property only reflect what the system classloader sees.  Your
> task has been loaded by a different classloader that has your custom
> jars in it as well.  You can get this ClassLoader via
> MyTask.class.getClassLoader().
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 
> 


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


Mime
View raw message