ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ding Shukai <dingshu...@gmail.com>
Subject Re: How to get each file's name in a fileset?
Date Mon, 12 Dec 2005 09:14:26 GMT
great. It works well .
but I still have a question: how to use the property ${ports} ? The
buildfile  gets a property containing ports separated by line.separator, but
I still do not know how to retrieve each port name from the ${ports}.
bow~

2005/12/12, Jan.Materne@rzf.fin-nrw.de <Jan.Materne@rzf.fin-nrw.de>:
>
> 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> element.
> 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 the
>    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
> C:.
> |   build.xml
> |
> \---schema
>    |   123.wsdl
>    |   4711.wsdl
>    |   XXX.wsdl
>    |
>    \---dev
>            9998.wsdl
>            9999.wsdl
>
>
> C:\TEMP\ant-mapper>ant
> Buildfile: build.xml
>     [echo] PORTS:
>     [echo] 123
>     [echo] 4711
>     [echo] XXX
>     [echo] 9998
>     [echo] 9999
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
> C:\TEMP\ant-mapper>
>
>
> Jan
>
>
>
> >-----Urspr├╝ngliche Nachricht-----
> >Von: Ding Shukai [mailto:dingshukai@gmail.com]
> >Gesendet: Montag, 12. Dezember 2005 05:54
> >An: user@ant.apache.org
> >Betreff: How to get each file's name in a fileset?
> >
> >hi,
> >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
> >build.properties. Could anyone Help me, please? Thanks~
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message