Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

ant question

Thread view: 
slippymississippi@yahoo.com - 08 Dec 2005 06:52 GMT
I am fairly new to Java, so I have been using Maven 2.0 exclusively to
build.  Not wanting my system config files to clutter CVS, I was trying
to simply move them into the right directories using ant, which is
working fine.  But I want to edit the hosts file, and if the host value
I want is not there, to add it.

This seems more like a grep function than something that could be done
easily by ant, but I want this to be platform independent.  Is this
something I should do with perl, or can ant do the job?
stevengarcia@yahoo.com - 08 Dec 2005 09:31 GMT
you can do pattern recognition and replacement...that is if your file
contents are

hostname=mercury,venus,%planet%

and you set "planet=earth" as a system property or a property passed in
(or read in) by Ant, then when you copy the file above to a new
location it will replace %planet% with whatever it is set to.

Is that what you are looking for?

Look at the <copy> task and the subtask <filter>
slippymississippi@yahoo.com - 08 Dec 2005 14:20 GMT
Actually, I was thinking of verifying that an IP/hostname pair were
defined in my etc/hosts file, and adding it if I fail to detect.

Does ant have a regexp search function?
Roedy Green - 08 Dec 2005 23:37 GMT
>Does ant have a regexp search function?
it has an exec.  Probably easiest to cook up some simple little
utility to do what you want.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

slippymississippi@yahoo.com - 09 Dec 2005 00:48 GMT
> it has an exec.  Probably easiest to cook up some simple little
> utility to do what you want.

Gotcha.  I noticed that someone had a grep task for ant out there,
though.
Hiran Chaudhuri - 10 Dec 2005 14:03 GMT
>>Does ant have a regexp search function?
> it has an exec.  Probably easiest to cook up some simple little
> utility to do what you want.

Ant has been developed to have platform neutral make scripts. If you call
something like grep your script won't be portable as easily.

Hiran


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.