ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bender, Christopher" <Christopher.Ben...@tdsecurities.com>
Subject RE: Nested Tasks
Date Tue, 14 Oct 2003 15:07:28 GMT
yeah, thanks for all the help.  The error was actually with the way ant was handling the xml.
 In my actual build file i had a task called something like Task1, with a capitol T.  When
a task is nested, ant was converting all names to task1, with s small case t.  That is why
they would work individually but not nested.  ant could find Task1 bc i def'd that, but task1
was not defd

-----Original Message-----
From: peter reilly [mailto:peter.reilly@corvil.com]
Sent: Tuesday, October 14, 2003 11:05 AM
To: Ant Users List
Subject: Re: Nested Tasks


On Tuesday 14 October 2003 15:38, peter reilly wrote:
> It does in ant 1.6.
> In ant 1.5 it does not as the task
> would have already been resolved.
>
> If execute is not used in ant 1.6 I get

Opps that should if execute is used..

> the error you are getting:
>  Could not create task of type: task2
>
> Just make sure that you are not running ant 1.6.
>
> Peter

I have used the class you posted in package task with a build build as
follows:

<project default="c">
  <target name="c">
    <mkdir dir="classes"/>
    <javac srcdir="src" destdir="classes"/>
    <taskdef name="task1" classname="task.Task1"
             classpath="classes"/>
    <taskdef name="task2" classname="task.Task2"
             classpath="classes"/>

    <task1/>
    <task2/>
    <task1>
      <task2/>
    </task1>
  </target>
</project>

and task2 defined as:
package task;

import org.apache.tools.ant.Task;

public class Task2 extends Task {
    public void execute() {
        System.out.println("Hello world");
    }
}

This works fine for ant 1.5.4 but fails with ant 1.6.

Peter
>
> On Tuesday 14 October 2003 15:31, Bender, Christopher wrote:
> > ok but that doesnt help ant find the task.
> > but thanks for that, i remember reading to call perform somewhere.
> >
> > -----Original Message-----
> > From: peter reilly [mailto:peter.reilly@corvil.com]
> > Sent: Tuesday, October 14, 2003 10:28 AM
> > To: Ant Users List
> > Subject: Re: Nested Tasks
> >
> > On Tuesday 14 October 2003 15:15, Bender, Christopher wrote:
> > > 	private void executeChildren() {
> > > 		Iterator taskItr = tasks.iterator();
> > > 		while (taskItr.hasNext()) {
> > > 			((Task)taskItr.next()).execute();
> > > 		}
> >
> > You need to do ((Task)taskItr.next()).perform() and not
> > execute.
> >
> > Peter
> >
> > ---------------------------------------------------------------------
> > 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
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message