I think the source of the confusion is this:
http://jakarta.apache.org/ant/manual/develop.html
It specifically shows defining a task outside a target. It should be
updated to show the alternative of compiling and then defining the task.
Below is an exerpt from a build file that I use all the time. I just have to
make sure that this target is listed as a dependency of any target that is
going to use that task.
<target name="build-custom-tasks" depends="compile-source">
<javac srcdir="source-tasks" destdir="classes-tasks">
<classpath refid="class.path" />
</javac>
<taskdef name="translationcheck"
classname="com.wamnet.task.TranslationCheck">
<classpath>
<path refid="class.path" />
</classpath>
</taskdef>
</target>
Tim
> -----Original Message-----
> From: Peter Donald [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 11, 2001 5:15 AM
> To: Ovidiu Predescu
> Cc: [EMAIL PROTECTED]
> Subject: Re: PROPOSAL: loading tasks from jars for Ant 1.5
>
>
> On Thu, 11 Oct 2001 07:38, Ovidiu Predescu wrote:
> > On Thu, 11 Oct 2001 06:52:51 +1000, Peter Donald
> <[EMAIL PROTECTED]> wrote:
> > > On Thu, 11 Oct 2001 04:41, Sam Ruby wrote:
> > > > Ovidiu Predescu wrote:
> > > > > A simpler solution to the one proposed above is to
> this is to allow
> > > > > antlib to appear inside a <target> element. This way
> one can write
> > > > > the build.xml file that builds a new antlib in a
> target, and makes
> > > > > use of it in another target. Something like this:
> > > > > [snip]
> > > > > I'm not sure what are the implications with the
> current class loader
> > > > > mechanisms, but a solution can probably be worked out.
> > > >
> > > > I believe that some of the Ant 2.x designs are
> conducive to such an
> > > > approach, but the last time I looked, this was
> problematic with the
> > > > current design.
> > >
> > > It is already possible now ! ;)
> >
> > I would be very interested to see how ;-). Could you give
> an example?
>
>
> <javac .../>
> <jar .../>
> <taskdef .../>
>
> should work. It used to ... at one stage avalons build file
> did that. Not
> sure if anything has changed in ant to make this harder?
>
> --
> Cheers,
>
> Pete
>
> ------------------------------------------
> I just hate 'yes' men, don't you Smithers?
> ------------------------------------------
>