ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
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.

Peter


On 7/30/07, stanS <stanley_siu@ml.com> 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: http://www.nabble.com/Getting-classpath-attribute-of-custom-task-tf4171205.html#a11866788
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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