Duh.  I should have known that.

Going on, however, I seem to be doing something wrong when I use
"antCall" in the forEach loop to call a target, or something at a more
basic level.  The following is an excerpt showing the forEach loop that
calls the target, and the target after it.

     <j:forEach items="${springContexts.iterator()}"
var="springContext">
      <echo message="springContext[${springContext}]"/>
      <ant:antCall target="processSpringContext" inheritAll="true">
       <param name="file" value="${springContext}"/>
      </ant:antCall>
     </j:forEach>
     <ant:target name="processSpringContext">
       <echo message="Processing the Spring context: ${file}"/>
     </ant:target>

When I call this, the first "echo" shows the name of the first file
(there's only file in the set), but the rest of the output is odd
(somewhat elided):

--------------
    [echo] springContext[...\MyServiceContext.xml]
<antCall inheritAll="true" target="processSpringContext"><param
value="...\MyServiceContext.xml" name="file"></param></antCall><target
name="processSpringContext">    [echo] Processing the Spring context: 
</target>castor:prepare-filesystem:
--------------

It puts the "antCall" code from maven.xml into the output, showing the
substitution in the "value" attribute, but when it executes the "echo"
in the target, it prints blank for the parameter value.

> -----Original Message-----
> From: Lukas Theussl [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, November 03, 2007 11:31 PM
> To: Maven Users List
> Subject: Re: Maven1: How to use ant-contrib "foreach" in a 
> maven.xml goal
> 
> You can use jelly's forEach tag [1], eg here is a snippet 
> used in the m1 xdoc plugin:
> 
>        <fileScanner var="xmlFiles">
>          <fileset dir="${maven.docs.src}">
>            <patternset>
>              <include name="**/*.xml"/>
>              <exclude name="**/${maven.xdoc.navigation.file}" />
>            </patternset>
>          </fileset>
>        </fileScanner>
>        <j:forEach var="file" items="${xmlFiles.iterator()}">
>          ...
>        </j:forEach>
> 
> HTH,
> -Lukas
> 
> 
> [1] http://commons.apache.org/jelly/tags.html
> 
> 
> Karr, David wrote:
> > I have a set of targets in an Ant script that I'm trying to 
> integrate 
> > into a goal in subproject maven.xml.  One of the steps is 
> to iterate 
> > over a list of files found in a directory, using the Ant-contrib 
> > "foreach" tag.  This works fine in the Ant script, but when 
> I do this 
> > in my maven.xml file, when it executes the "foreach" tag, 
> it seems to 
> > want to find the specified target in a "build.xml" in the 
> same directory.
> > I'm guessing Ant-contrib's Foreach tag wasn't built to 
> allow for this 
> > possibility.  Is there a different way to do this that will work in 
> > Maven 1?
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to