Friday, September 08, 2006
'ListOfFiles' ant task
Here is an ant task, that converts ant FileSet into property containing string with list of files. I have used that task many times in my ant scripts. Most useful use cases include building "Class-Path:" manifest attribute and list of files for compc Flex 2 compiler.
It can be used in many other places where you need to convert fileset into a string of comma or space separated files.
You can download source and jar for this task at http://igorgrapp.com/files/anttools.zip
Here is an example on how to use it:
For more examples download zip file and check out test.xml
There are number of utilities that need to be run during project build process and require to pass files as list of comma or space separated arguments.
It can be used in many other places where you need to convert fileset into a string of comma or space separated files.
You can download source and jar for this task at http://igorgrapp.com/files/anttools.zip
Here is an example on how to use it:
<project …
<taskdef name="list-of-files" class="com.igorgrapp.taskdefs.ListOfFilesTask">
<classpath>
<pathelement location="ant-igrapp.jar"/>
</classpath>
</taskdef>
...
<target …
<list-of-files separator=" " outProperty="libs" prefix="../lib">
<fileset dir="${basedir}/lib">
<include name="**/*.jar"/>
</fileset>
</list-of-files>
<jar destfile="some.jar">
<manifest>
<attribute name="Class-Path" value="${libs}">
...
For more examples download zip file and check out test.xml
There are number of utilities that need to be run during project build process and require to pass files as list of comma or space separated arguments.