ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <>
Subject Re: Classpath for Taskdef?
Date Sun, 24 Apr 2005 14:15:15 GMT
Hello Wolverine My,

yes it is possible to extend the classpath for specific tasks. The 
<taskdef/> task supports the following attributes :


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"/>
<taskdef name="myspecifictask" classname="org.mybusiness.mytask" 

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 
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).



wolverine my wrote:

>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:
For additional commands, e-mail:

View raw message