ant question

Discussion in 'Java' started by slippymississippi@yahoo.com, Dec 8, 2005.

  1. Guest

    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?
    , Dec 8, 2005
    #1
    1. Advertising

  2. Guest

    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>
    , Dec 8, 2005
    #2
    1. Advertising

  3. Guest

    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?
    , Dec 8, 2005
    #3
  4. Roedy Green Guest

    On 8 Dec 2005 06:20:14 -0800, wrote,
    quoted or indirectly quoted someone who said :

    >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.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Java custom programming, consulting and coaching.
    Roedy Green, Dec 8, 2005
    #4
  5. Guest

    > 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.
    , Dec 9, 2005
    #5
  6. "Roedy Green" <> schrieb im
    Newsbeitrag news:...
    >>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
    Hiran Chaudhuri, Dec 10, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Bedford
    Replies:
    6
    Views:
    2,230
  2. Mike G.

    jar using ant question

    Mike G., Sep 18, 2003, in forum: Java
    Replies:
    2
    Views:
    6,203
    Lee Peterson
    Sep 19, 2003
  3. john martin
    Replies:
    2
    Views:
    2,213
    john martin
    Apr 7, 2005
  4. Replies:
    1
    Views:
    498
    Larry
    Mar 7, 2006
  5. Replies:
    6
    Views:
    868
Loading...

Share This Page