You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Edoardo Vacchi <un...@gmail.com> on 2014/04/15 09:10:55 UTC

ClassLoader classpath of a TaskDef'd task

My taskdef'd task uses
   Thread.currentThread().getContextClassLoader();
to load dynamically a series of classes *during* the execution of the task
itself. These classes are actually the same jar of the task implementation.

Now, if I put my jars in ~/.ant/lib the task works. If I use
<taskdef ...>
   <classpath>...</classpath>
</taskdef>

where classpath points to the ./lib/* folder of the project, the task *is*
found, but the classloader fails to load the classes. I suppose that ant is
changing the classloader for the task's thread. How can I pass the
<classpath/> information down to the task's classloader?

thanks

Re: ClassLoader classpath of a TaskDef'd task

Posted by Edoardo Vacchi <un...@gmail.com>.
Please notice that I am having the problem in *netbeans*! the problem seems
not to be occurring from the CLI


On Tue, Apr 15, 2014 at 9:10 AM, Edoardo Vacchi
<un...@gmail.com>wrote:

> My taskdef'd task uses
>    Thread.currentThread().getContextClassLoader();
> to load dynamically a series of classes *during* the execution of the task
> itself. These classes are actually the same jar of the task implementation.
>
> Now, if I put my jars in ~/.ant/lib the task works. If I use
> <taskdef ...>
>    <classpath>...</classpath>
> </taskdef>
>
> where classpath points to the ./lib/* folder of the project, the task *is*
> found, but the classloader fails to load the classes. I suppose that ant is
> changing the classloader for the task's thread. How can I pass the
> <classpath/> information down to the task's classloader?
>
> thanks
>
>