ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: Build question
Date Sat, 29 Jun 2002 02:19:53 GMT
--- Viraf Bankwalla <> wrote:
> I have a set of directories that follow a naming convention:
>    **/a/b/*/**
> I want to be able identify all directories that match * and then call
> a task with the matched name *.  How would one go this in Ant 1.4.1?

In 1.4.1, with a custom task or a <script>. If you upgrade to 1.5, you can
do it with built-in tasks + ant-contrib's <foreach> (I'm assuming you
actually meant call a target, not call a task):

  <taskdef resource="net/sf/antcontrib/"/>

  <target name="runDirTargets">
    <dirset id="ds1" dir="viraf" includes="**/a/b/*"/>
    <pathconvert property="ds1" pathsep="," refid="ds1"/>
    <foreach list="${ds1}" target="runDirTarget" param="dir"/>

  <target name="one">
    <echo>Running target one...</echo>

  <target name="two">
    <echo>Running target two...</echo>

  <target name="runDirTarget">
    <basename file="${dir}" property="target.dir"/>
    <antcall target="${target.dir}"/>


Results in:
     [echo] Running target one...

     [echo] Running target two...



Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message