ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dc ...@wm.namco.co.jp>
Subject Re[4]: How do I update a property file correctly?
Date Thu, 10 Jul 2003 08:17:56 GMT

from [ "Daniel Joshua" <daniel.joshua@gridnode.com> ] on [ Thu, 10 Jul 2003 16:08:32
+0800 ]

>   Yup, but quite a few lines...
>   
>   ... although, this will actually keep the comments, right?

should keep the file intact, but you cant add comments at the end of a
line in the props file.

build.timestamp=@TIMESTAMP@		#comment

will stick spaces + your comment as a value into ${build.timestamp}

it is quite nice how you can sub-ref properties within the file, and
everything works itself out!

## in props file
build.timestamp=@TIMESTAMP@
ver.name=${build.timestamp}.name


/dc


>   
>   The alternative is <propertyfile>, but does not keep comments at the moment
>   :(
>   
>   Regards,
>   Daniel
>   
>   
>   -----Original Message-----
>   From: dc [mailto:dc@wm.namco.co.jp]
>   Sent: Thursday, 10 July, 2003 2:26 PM
>   To: Ant Users List
>   Subject: Re[2]: How do I update a property file correctly?
>   
>   
>   you could also have a template properties file that you copy and
>   overwrite each time... means doing it at start and end of your build but
>   gives control...
>   
>   
>   in your template template.props
>   	build.timestamp=@TIMESTAMP@
>   
>   
>   <copy  todir="${template}">
>       <fileset dir="${common.dir}/res/" includes="template.*" />
>           <filterchain>
>               <filterreader
>   classname="org.apache.tools.ant.filters.ReplaceTokens">
>                   <param type="token" name="TIMESTAMP"
>   value="${timestamp}"/>
>   
>   etc.
>   
>   from [ Jan.Materne@rzf.fin-nrw.de ] on [ Thu, 10 Jul 2003 08:12:25 +0200 ]
>   
>   >   Do you know <propert> task?
>   >
>   >
>   >   Jan
>   >
>   >   > -----Original Message-----
>   >   > From: Daniel Joshua [mailto:daniel.joshua@gridnode.com]
>   >   > Sent: Thursday, July 10, 2003 5:25 AM
>   >   > To: 'Ant Users List'
>   >   > Subject: How do I update a property file correctly?
>   >   >
>   >   >
>   >   > Hi all,
>   >   >
>   >   > Is there a easy way to update a property file correctly?
>   >   >
>   >   > This is what I tried:
>   >   >
>   >   >     <echo file="timestamp.properties"
>   >   > message="build.timestamp=${timestamp}"
>   >   > append="true"/>
>   >   >
>   >   > ... the file originally contained ...
>   >   >
>   >   >  build.timestamp=20030708-1039
>   >   >  setup.timestamp=20030708-1044
>   >   >
>   >   > ... but after appending the file contained ...
>   >   >
>   >   >  build.timestamp=20030708-1039
>   >   >  setup.timestamp=20030708-1044
>   >   >  build.timestamp=20030708-1120
>   >   >
>   >   > ... instead of what I wanted, which is ...
>   >   >
>   >   >  build.timestamp=20030708-1120
>   >   >  setup.timestamp=20030708-1044
>   >   >
>   >   > Any Suggestions?
>   >   >
>   >   >
>   >   > PS: Only way I can think of is to read through all the
>   >   > properties, and to
>   >   > write them back without appending, but I find this tedious...
>   >   > especially
>   >   > when the property file contains alot of other stuff.
>   >   >
>   >   >
>   >   > Regards,
>   >   > Daniel
>   >   >
>   >   >
>   >   > ---------------------------------------------------------------------
>   >   > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>   >   > For additional commands, e-mail: user-help@ant.apache.org
>   >   >
>   
>   /dc
>   +-----+-----------------------------------------+
>   david [dc] collier
>   
>   NAMCO Ltd.
>   Web & Mobile Contents Business Group
>   
>     e   |   dc@wm.namco.co.jp
>     v   |  +81(0)90 7414 6107
>   
>   
>   ---------------------------------------------------------------------
>   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

/dc
+-----+-----------------------------------------+
david [dc] collier

NAMCO Ltd.
Web & Mobile Contents Business Group

  e   |   dc@wm.namco.co.jp
  v   |  +81(0)90 7414 6107


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


Mime
View raw message