ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ninju Bohra <ninju_bo...@yahoo.com>
Subject Re: set a property in a .properties file
Date Wed, 20 Dec 2006 03:46:09 GMT
You may want to look at the FilterChains and FilterReaders elements to 'select' which lines
of the original properties file to copy and then merely append the new line.

Maybe use the <lineContainsRegExp> element to 'select' all the lines EXCEPT the one(s)
you want to change and copy the 'selected' lines to a temp file and then merely <echo>
the new property value into the temp file and the copy the temp to the final name/location.

Alternately you can create your own FilterReader...rather simple but requires a little JAVA
coding experience

Hope that helps,

Ninju
 




----- Original Message ----
From: jm <jmuguruza@gmail.com>
To: Ant Users List <user@ant.apache.org>
Sent: Tuesday, December 19, 2006 8:07:05 AM
Subject: Re: set a property in a .properties file


Peter,

thanks for pointing that out, I'll check that if it works that would
be perfect. The 'maybe its easy' comment was moslty thinking aloud
without any prior knowledge obviously...

On 12/19/06, Peter Reilly <peter.kitt.reilly@gmail.com> wrote:
> On 12/19/06, jm <jmuguruza@gmail.com> wrote:
> > Antoine,
> > echoing would add a second line with the property no?, and I want the
> > exisiting line to be modified...propertyFile would do, I had missed
> > that one, it's a pity comments are lost though...
> >
> > Gilbert ,
> > yes I think that would work, but I have never used any of these
> > scripting languages.
> >
> > does anybody know where the souce code for propertyFile is? maybe its
> > easy to make it keep the comments...
> >
> There is a patch for this.
> http://issues.apache.org/bugzilla/show_bug.cgi?id=36901
> I would not call it "easy".
>
> Peter
>
> > thanks both,
> > javi
> >
> > On 12/19/06, Rebhan, Gilbert <Gilbert.Rebhan@huk-coburg.de> wrote:
> > >
> > > Oops,
> > >
> > > should have been =
> > >
> > > test.props afterwards :
> > > foo=nobar
> > >
> > >
> > > Regards, Gilbert
> > >
> > >
> > > -----Original Message-----
> > > From: jm [mailto:jmuguruza@gmail.com]
> > > Sent: Tuesday, December 19, 2006 11:45 AM
> > > To: Ant Users List
> > > Subject: set a property in a .properties file
> > >
> > > hi,
> > >
> > > I have been looking for a way to set a property in a .properties file
> > > via ant. Could not find any easy way...somebody knows a way to do it
> > > or a external task or something?
> > >
> > > I know about the <replace> stuff, but I am trying to change the
> > > property without knowing the value it had before, that is, I cannot
> > > assume it is 'aproperty=@replaceme@'
> > >
> > > thanks,
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message