ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: How to get each file's name in a fileset?
Date Mon, 12 Dec 2005 06:48:17 GMT
try nested mappers

01: <project>
02:     <property name="schema.dir" location="schema"/>
03:     <pathconvert property="ports" pathsep="${line.separator}">
04:         <fileset dir="${schema.dir}" includes="**/*.wsdl"/>
05:         <map from="${schema.dir}${file.separator}" to=""/>
06:         <mapper>
07:             <chainedmapper>
08:                 <globmapper from="*.wsdl" to="*"/>
09:                 <flattenmapper/>
10:             </chainedmapper>
11:         </mapper>
12:     </pathconvert>
13:     <echo>PORTS:</echo>
14:     <echo>${ports}</echo>
15: </project>

02: Define the schema dir as location, so I can reuse the absolute path in the <map>
03: Use ${line.separator} for better output. Use like you want.
05: Deletes the leading absolute path. Because 02 gets only the path we also have to delete
    dir separator there.
07: Apply two mappers in chain. Otherwise you┬┤ll double your output....
08: Delete the suffix
09: Delete directory hierarchy.

C:\TEMP\ant-mapper>tree /A /F
|   build.xml
    |   123.wsdl
    |   4711.wsdl
    |   XXX.wsdl

Buildfile: build.xml
     [echo] PORTS:
     [echo] 123
     [echo] 4711
     [echo] XXX
     [echo] 9998
     [echo] 9999

Total time: 0 seconds


>-----Urspr├╝ngliche Nachricht-----
>Von: Ding Shukai [] 
>Gesendet: Montag, 12. Dezember 2005 05:54
>Betreff: How to get each file's name in a fileset?
>In my project, the ant buidfile needs to know each file's name 
>in a fileset.
>For example, there exists some files like XXX.wsdl in the 
>schema dir; if I could get the string XXX, which is a porttype 
>name, then I neednot to specify the porttype names in 
> Could anyone Help me, please? Thanks~

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message