Hello Wolverine My,
yes it is possible to extend the classpath for specific tasks. The
<taskdef/> task supports the following attributes :
classpath
classpathref,
loaderref
classpathref will be followed by the ID of a path defined before in your
build file with a construct like
<path id="my.specific.classpath">
<pathelement location="some.jar"/>
<fileset dir="some.path">
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef name="myspecifictask" classname="org.mybusiness.mytask"
classpathref="my.specific.classpath"/>
Additionally, you can use the loaderref attribute, if you want to load
different tasks/types using the same classloader.
In this case, all the taskdef/typedef using the specific classpath
should have a loaderref attribute with the same value (For instance
"myloader").
The first taskdef/typedef which will be executed by ant should have the
classpath or the classpathref attribute set.
(Not 100% sure about this last bit of explanation, but this is at least
how I understand the code).
Cheers,
Antoine
wolverine my wrote:
>Hi!
>
>There are times we have to explicity set the CLASSPATH before
>executing Ant, e.g. specifying the 3rd party JAR where the new Ant
>task is defined. Otherwise, we will hit the error 'taskdef class
>ZKMTask cannot be found'.
>
>May I know if we are able to set the CLASSPATH for <Taskdef> so that
>we don't have to remind ourselve everytime we build the program?
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
|