I found foreach, (thank you Tim), and that's exactly what I plan to do.

Also, I had to get Ant.java out of CVS to get around the 1.3 bug that was mentioned in ant-dev.

Thinks are working great now.

-Jeff

Diane Holt wrote:

--- Jeffrey A Kenward <[EMAIL PROTECTED]> wrote:
> What's the best way to invoke a task from another task?
>
> For instance, I'm trying to write a task to search for build files
> further down in the build tree and invoke the ANT task on it once it's
> found.

You could use the newly submitted (but not committed) <foreach> task (I
picked up Chris Greenlee's updated version) -- see the ant-dev mail
archives at message:
  http://marc.theaimsgroup.com/?l=ant-dev&m=98842104504477&w=2

It's designed to do <antcall>'s, which means running a target in the
current build-file, but that target could do an <ant>. For example:

  <target name="recurse">
    <taskdef name="foreach"
       classname="org.apache.tools.ant.taskdefs.optional.ForeachTask"/>
    <foreach target="runAnt">
      <param name="file">
        <fileset dir="." includes="**/build.xml"/>
      </param>
    </foreach>
  </target>

  <target name="runAnt">
    <ant antfile="${file}"/>
  </target>

This will run the default target in each build.xml file in every
subdirectory of the current directory. If you want to run a specific
target in the sub-project build-files, include the "target" attribute in
the <ant> task (include nested <property>'s if you want to override
property values in the sub-project build-files).

Note: You'll need to pick up the latest Ant.java from CVS, as apparently
the <foreach> task hits a bug that was in the 1.3 version, which has since
been fixed in CVS.

Diane

=====
([EMAIL PROTECTED])

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

begin:vcard 
n:Kenward;Jeff
tel;pager:(313) 280-0854
tel;cell:(313) 715-3170
tel;work:(313) 235-3586
x-mozilla-html:TRUE
url:http://www.kenward.org
org:Electric Choice Implementation Team;ISO
version:2.1
email;internet:[EMAIL PROTECTED]
title:Principal Analyst
adr;quoted-printable:;;2000 2nd Ave.=0D=0A246 SB;Detroit;MI;48226;USA
fn:Jeff Kenward
end:vcard

Reply via email to