Ant concat file separator

When using concat with a file set in Ant, how can I do an action for each element in a file set. For example, adding the line:

<fileset dir="${project.path.scripts-library}" excludes="!*.js, **/*.bak, **/dev.*" > <type type="file" /> <include name="**/0*.js" /> <include name="**/1*.js" /> <string>test</string> </fileset> 

Or repeat the current file name for each file in the file set (and how can I get the file name for the current file ???):

 <fileset dir="${project.path.scripts-library}" excludes="!*.js, **/*.bak, **/dev.*" > <echo file="${app.path.file}" append="true" message=",${the.file.name}" /> <type type="file" /> <include name="**/0*.js" /> <include name="**/1*.js" /> </fileset> 
+4
source share
1 answer

I think that in default ant there is no such thing. The closest <apply> , but it is system specific:

 <apply executable="echo"> <!-- run this command with each file name --> <fileset dir="/tmp" includes="**/*.*"/> </apply> 

You can also install ant-contrib to enable <for> :

 <taskdef resource="net/sf/antcontrib/antcontrib.properties"/> <for param="file"> <path> <fileset dir="/tmp" includes="**/*.*"/> </path> <sequential> <!-- run any task here --> <echo>file [@{file}]</echo> </sequential> </for> 
+4
source

All Articles