dcsimg
Smart replace using <replace>
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Daniel_L
Posted On:   Tuesday, September 4, 2001 07:37 AM

Hi everybody ! I'm trying to do the following : 1. I've defined a replace_strings.properties, like this : first_old_text=first_new_text second_old_text=second_old_text . . . 2. Now, i want to Ant to be able to read this file and perform replacement in another file (like test.txt). The trick is that i don't want to write tags like : property="property.first_new_text"/> Can i do a smart replacement of these strings ? I was expecting to read the file replace_strings.prop   More>>

Hi everybody !



I'm trying to do the following :



1. I've defined a replace_strings.properties, like this :



first_old_text=first_new_text

second_old_text=second_old_text

.

.

.



2. Now, i want to Ant to be able to
read this file and perform replacement
in another file (like test.txt). The
trick is that i don't want to write
tags like :






property="property.first_new_text"/>




Can i do a smart replacement of
these strings ? I was expecting to read
the file replace_strings.properties and
to perform all the necessary
replacement automatically. Is this
possible ?





Thanks in advance.

   <<Less

Re: Smart replace using &lt;replace&gt;

Posted By:   Erik_Hatcher  
Posted On:   Tuesday, September 4, 2001 04:12 PM

According to Ant 1.4's documentation on the task it does not seem possible to do what you want. If you have the flexibility to tokenize your source file(s) with "@token@" syntax then you could use a combination of task combined with a process. The task takes a filtersfile attribute to load a properties file similar to your example, and then a filtered would replace tokens appropriately.


Will that accomplish what you need?

About | Sitemap | Contact