Re: Maven1: How to use ant-contrib foreach in a maven.xml goal
I don't see why this wouldn't work, it should. I tried a little test case modelled on your snippet and got the desired result. If you can't get it to work, try to cut it down to a small reproducible test case and attach it to jira. -Lukas Karr, David wrote: 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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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
RE: Maven1: How to use ant-contrib foreach in a maven.xml goal
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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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]
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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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]
RE: Maven1: How to use ant-contrib foreach in a maven.xml goal
If I can't use antcall, will I not be able to use the xmltask library, which calls Ant targets on xmlpath strings? -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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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]
Re: Maven1: How to use ant-contrib foreach in a maven.xml goal
Don't know, try! :) You can always call external ant targets from maven.xml [1], I just meant the example you gave won't work, because you defined a target within a goal. -Lukas [1] http://maven.apache.org/maven-1.x/using/migrating.html#Calling_Ant_Scripts_from_Maven Karr, David wrote: If I can't use antcall, will I not be able to use the xmltask library, which calls Ant targets on xmlpath strings? -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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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]
RE: Maven1: How to use ant-contrib foreach in a maven.xml goal
And is it possible to pass parameters to goals? I need to execute the goal with a different value for a parameter, each time in a loop. From my googling on this, I see some subtle clues that make it seem like this is possible, but the actual examples never do it. -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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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]
RE: Maven1: How to use ant-contrib foreach in a maven.xml goal
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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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]
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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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]
RE: Maven1: How to use ant-contrib foreach in a maven.xml goal
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=processSpringContextparam value=...\MyServiceContext.xml name=file/param/antCalltarget name=processSpringContext[echo] Processing the Spring context: /targetcastor: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
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]