ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lieve Van den Heuvel" <>
Subject Re: Replacing tokens without token delimiters
Date Thu, 10 Feb 2005 13:24:54 GMT
Have you tried the replace task?  I've used it to change data in a file
as well:
<replace dir="${}/${}"
token="$FRAMEWORK_VERSION" value="${framework.version}">
            <include name="**/*.cfg.xml"/>

maybe this helps..
>>> 10/02/2005 14:15:45 >>>

Hello all,

we've recently decided to replace all our shell scripts with ant tasks,
and I'm currently faced with the following problem: I need to replace
arbitrary strings in a number of source files with different values,
e.g. "" would be replaced by "",
"prod.value=5" by "test.value=10", etc. 
The problem is that the strings to be changed aren't clearly (i.e. with
a distinctive begin/end character) delimited in the source files.

I have a property file where all the strings to be replaced, as well as
their new values, are defined. I've tried to do this :

<copy todir="${new.dir}">
    <fileset refid="filesToBeChanged"/>
    <filterset begintoken="" endtoken="">
        <filtersfile file="${}"/>

However, this fails because filterset won't accept empty delimiters.
I've thought of using the replace task instead, but I can't define the
tokens to be replaced using a property file: I have to list them all by
hand in the build.xml file. Is there any way to avoid listing all the
replacement strings in the build.xml file and still use the replace

Thanks in advance.

Laurent Leconte

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

View raw message