ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <>
Subject Re: Getting classpath attribute of custom task
Date Mon, 30 Jul 2007 17:34:54 GMT
The classpath attribute is not available to the created task.

In the task one can use MyTask.class.getClassLoader() to
get the classloader that loaded the task.
If this is of type AntClassloader, one can use AntClassloader.getClassPath()
to get the path used in the loader.

However there are a number of issues with this:
  - the MyTask may be in a system classpath, or other classpath - in which
    case, the classloader seen will not be the classloader used by <taskdef>
 - there must be other means to achive the same goal.
   - for example keep a reference to the path use use this refernce for
   the <java> task.


On 7/30/07, stanS <> wrote:
> Lets say I have a taskdef in the build.xml
>    <taskdef name="mytask"
>                  classname="MyTask"
>                  classpath="path-to/my.jar" />
> How do I get the 'classpath' part in the custom task that derived from Ant
> Task class?
> Could you point me to the right API?
> I want to use that classpath back with a 'java' task.
> Thanks
> Stan.
> --
> View this message in context:
> Sent from the Ant - Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message