I did that but the result is the same.  In the goal, when it prints the
value of the property, instead of printing the value that printed in the
forEach loop, it just printed "true". 

> -----Original Message-----
> From: Lukas Theussl [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, November 04, 2007 1:03 PM
> To: Maven Users List
> Subject: Re: Maven1: How to use ant-contrib "foreach" in a 
> maven.xml goal
> 
> attainGoal is an empty tag:
> 
> <attainGoal name="${goal}" />
> 
> use j:set before that.
> 
> -Lukas
> 
> 
> Karr, David wrote:
> > I tried doing something like this:
> > 
> > ------------
> >      <j:forEach items="${springContexts.iterator()}"
> > var="springContext">
> >       <echo message="springContext[${springContext}]"/>
> >       <attainGoal name="processSpringContext">
> >        <j:set var="springContext.file" value="${springContext}"/>
> >       </attainGoal>
> >      </j:forEach>
> >    </preGoal>
> >    <goal name="processSpringContext">
> >      <echo message="Processing the Spring context:
> > ${springContext.file}"/>
> >    </goal>
> > ------------
> > 
> > This seems close, using "j:set" to set variables that I 
> reference in 
> > the goal.  However, it doesn't quite work.  The first "echo" prints 
> > the name of the file, but when I pass that into 
> "springContext.file" 
> > and then dereference it in the called goal, it just prints "true".
> > 
> > 
> >>-----Original Message-----
> >>From: Lukas Theussl [mailto:[EMAIL PROTECTED]
> >>Sent: Sunday, November 04, 2007 12:03 PM
> >>To: Maven Users List
> >>Subject: Re: Maven1: How to use ant-contrib "foreach" in a 
> maven.xml 
> >>goal
> >>
> >>It's antcall, not antCall. However, I don't think this works with 
> >>maven anyway, as maven has goals, not targets. You should transform 
> >>your targets into goals and use attainGoal to call them.
> >>
> >>HTH,
> >>-Lukas
> >>
> >>
> >>Karr, David wrote:
> >>
> >>>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]
> >>>
> >>>
> >>
> >>------------------------------------------------------------
> ---------
> >>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]
> 
> 

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

Reply via email to