| Retrieve property value dynamically? | Retrieve property value dynamically? 2003-03-24 - By JONES, MARSHALL, ALABS
Thanks very much. Exactly what I needed!!!
Marshall
------------------------------------------------------------------------------- --------- Marshall Jones - Software Engineer AT&T LABS - Custom and Web Services Development marshalljones@(protected) (813)878-5683 ------------------------------------------------------------------------------- ---------
-----Original Message----- From: Jan.Materne@(protected) [mailto:Jan.Materne@(protected)] Sent: Monday, March 24, 2003 12:52 AM To: user@(protected) Subject: AW: Retrieve property value dynamically?
Use <propertycopy/> of Ant-Contrib. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/ant-contrib/ant-co ntrib/manual/tasks/propertycopy.html
<propertycopy name="build.date" from="build.${buildnumber}.date" />
Ant-Contrib: Homepage: http://sourceforge.net/projects/ant-contrib/ CVS-Source: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ant-contrib/ant-contrib/src/n et/sf/antcontrib/ CVS-Manual: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ant-contrib/ant-contrib/manua l/index.html Binary: http://gump.covalent.net/jars/latest/ant-contrib/
Jan Mat?rne
> -----Urspr?ngliche Nachricht----- > Von: JONES, MARSHALL, ALABS [mailto:marshalljones@(protected)] > Gesendet am: Freitag, 21. M?rz 2003 19:29 > An: Ant Users List (E-mail) > Betreff: Retrieve property value dynamically? > > All, > Can the following be accomplished using properties? I > have tried several ways to do this, but have been > unsuccessful. Maybe there is a good reason this is not > allowed? Or maybe someone can suggest an alternative solution. > > I would like to retrieve the value of a property using a > dynamic name rather than hard-coding the name in my > buildfile. I am doing this because I do not know the range of > possible property values until runtime. > > Given a property file named "build.properties" with the > following data. > > allbuilds 0,1,2 > build.0.date 20030319 > build.1.date 20030320 > build.2.date 20030321 > > I need to extract the date of a particular build once the > user picks a build number to install. The following code is > an example of what I need to do: > > <property file="build.properties"/> > > <input validargs="${allbuilds}" addproperty="buildnumber" > message="Enter build number to install."/> > <property name="builddate" value="${build.${buildnumber}.date}}"/> > > The result should be builddate getting the value of > "20030320". Any assistance or ideas would be greatly appreciated. > > Marshall Jones > > > -------------------------------------------------------------- > -------------------------- > Marshall Jones - Software Engineer > AT&T LABS - Custom and Web Services Development > marshalljones@(protected) > (813)878-5683 > -------------------------------------------------------------- > -------------------------- > > > <<JONES, MARSHALL.vcf>> > >
|
|
 |