You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bh...@metriscompanies.com on 2001/08/07 22:08:26 UTC

Filter vs Replace

I am trying to determine whether the Filter or the Replace core task better
applies to my problem. I am trying to take a single file and create four
differnt versions of the file by replacing a particular value in the original
file. The value to be replaced is determined by the name of the box to which the
file has to be deployed.

ie.,    if name of box is abc, then replace @token1@ with xyz
    if name of box is def, then replace @token1@ with 123

Could anyone tell me what is the best approach to this probelm.


Regards,
Bharath Reddy,
Business Applications Programmer,
Metr1s Companies Inc.
Phone # (217)373-3310


Re: Filter vs Replace

Posted by "Larry V. Streepy, Jr." <st...@healthlanguage.com>.
A key question is whether you copy the file or not.  If you're copying
the file, then I find that filters are the simplest to manage.

Further, I would store the replacement filters in a file, whose name
includes the target box name.  Thus loading the replacement filters is
the same for each deployment, and just the name of the deployment target
is changed.

I've done something very similar to this in my build process and it
works very well.

One note, unlike the property task, the filter task will kill the build
if the specified filter file is not present.  Just something to keep in
mind.  I had to create a conditional target and use available to avoid
trying to read a filter file that does not exist.

Hope this helps.

Bharath.Reddy@metriscompanies.com wrote:
> 
> I am trying to determine whether the Filter or the Replace core task better
> applies to my problem. I am trying to take a single file and create four
> differnt versions of the file by replacing a particular value in the original
> file. The value to be replaced is determined by the name of the box to which the
> file has to be deployed.
> 
> ie.,    if name of box is abc, then replace @token1@ with xyz
>     if name of box is def, then replace @token1@ with 123
> 
> Could anyone tell me what is the best approach to this probelm.
> 
> Regards,
> Bharath Reddy,
> Business Applications Programmer,
> Metr1s Companies Inc.
> Phone # (217)373-3310

-- 
Larry V. Streepy, Jr.
Chief Technical Officer and VP of Engineering

Health Language, Inc.  -- "We speak the language of healthcare"

970/626-5028 (office)           mailto:streepy@healthlanguage.com
970/626-4425 (fax)              http://www.healthlanguage.com