ant-user mailing list archives

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

maybe this helps..
 
Greetings
Lieve
>>> laurent.leconte@francetelecom.com 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. "http://www.foo.com" would be replaced by "http://test.bar.net",
"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="${my.property.file}"/>
    </filterset>
</copy>

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
task?

Thanks in advance.

Laurent Leconte

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org





Mime
View raw message