ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject RE: lists of lists
Date Tue, 28 Sep 2004 04:10:17 GMT
> From: Ray Madigan []
> I have a complicated development environment and want to do something
> the following:
> all.list=alist,blist,clist
> alist=a,b,c
> blist=d,e,f
> clist=g,h,j
> <foreach param="" list="alist" target="foo"/>
> <target name="foo">
>   <foreach param="" list="${}"
> </target>
> <target name="bar">
>   <echo message="Project: ${} Component:
> </target>

Maybe this contrived example of the powers of Ant-Contrib's <ac:for>
will help you find a solution to your unusual situation. --DD

PS: <ac:for> seems a bit limited in how it delimit the tokens of the
    List, so put just the delimiter in between them without spaces.
    (Now that I know of String.split(regex) in JDK 1.4, anything less
    powerful is disappointing ;-)

D:\org_apache\antx>D:\com_lgc\cycle9\buildtools\ant\bin\ant -f
Buildfile: listOfLists.xml
     [echo] project: aap, element: all:
     [echo] project: aap, element: python
     [echo] project: ant, element: <target>
     [echo] project: ant, element: xml
     [echo] project: maven, element: <goal>
     [echo] project: maven, element: jelly

Total time: 0 seconds
D:\org_apache\antx>type listOfLists.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ac="antlib:net.sf.antcontrib">
  <property name="projects" value="aap,ant,maven" />

  <property name="aap" value="all:,python" />
  <property name="ant" value="&lt;target&gt;,xml" />
  <property name="maven" value="&lt;goal&gt;,jelly" />

  <ac:for list="${projects}" param="project">
      <ac:for list="${@{project}}" param="element">
          <echo>project: @{project}; element: @{element}</echo>

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

View raw message