You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michael Klein <Mi...@agilesoft.com> on 2000/08/15 02:30:50 UTC

building your own tasks

Is there a way to build ANT tasks within the same project they're being used?  It seems that regardless of where I put my <taskdef> directive, ANT
tries to load the class that implements the task before it does anything else, so I get the error:

taskdef class myclass cannot be found

I've tried the following, which doesn't work:

  <target name="buildtasks">
    -- build the task classes here --
  </target>

  <target name="usetasks" depends="buildtasks">
    <taskdef name="mytask" classname="..."/>
    <mytask .../>
  </target>

but it seems to try to load the 'mytask' classes before building them.

-mike



Re: building your own tasks

Posted by "William G. Thompson, Jr." <wg...@softcom.com>.
Michael Klein wrote:
> 
> Is there a way to build ANT tasks within the same project they're being used?  It seems that regardless of where I put my <taskdef> directive, ANT
> tries to load the class that implements the task before it does anything else, so I get the error:
> 
> taskdef class myclass cannot be found
> 
> I've tried the following, which doesn't work:
> 
>   <target name="buildtasks">
>     -- build the task classes here --
>   </target>
> 
>   <target name="usetasks" depends="buildtasks">
>     <taskdef name="mytask" classname="..."/>
>     <mytask .../>
>   </target>
> 
> but it seems to try to load the 'mytask' classes before building them.
> 
> -mike

I've run into the same problem.  The solution for me was to just build
the custom task seperately, and make sure the new task is in ant's
classpath.

Bill