Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 55143 invoked from network); 4 Aug 2008 21:02:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Aug 2008 21:02:19 -0000 Received: (qmail 52589 invoked by uid 500); 4 Aug 2008 21:02:13 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 52245 invoked by uid 500); 4 Aug 2008 21:02:12 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 52234 invoked by uid 99); 4 Aug 2008 21:02:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Aug 2008 14:02:12 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ejciramella@upromise.com designates 12.197.7.59 as permitted sender) Received: from [12.197.7.59] (HELO transporter.corp.upromise.com) (12.197.7.59) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 04 Aug 2008 21:01:14 +0000 Received: from upromise.com (wssmtp.corp.upromise.com [172.22.144.104]) by transporter.corp.upromise.com (Postfix) with ESMTP id 9823D4A23 for ; Mon, 4 Aug 2008 17:01:10 -0400 (EDT) Received: from wssmtp ([127.0.0.1]) by upromise.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 4 Aug 2008 17:01:10 -0400 Received: from knight.corp.upromise.com ([172.22.144.78]) by wssmtp with Microsoft SMTPSVC(6.0.3790.3959); Mon, 4 Aug 2008 17:01:10 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Loading interdependent properties files WAS RE: Trying (and failing) to build the nightly snapshot Date: Mon, 4 Aug 2008 17:01:10 -0400 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Loading interdependent properties files WAS RE: Trying (and failing) to build the nightly snapshot Thread-Index: Acj2SOjVXKQd3awzRzKCv6A/RexGuAABKV6gAAFA/2AABqyFkAAB+gAA From: "EJ Ciramella" To: "Ant Developers List" X-OriginalArrivalTime: 04 Aug 2008 21:01:10.0597 (UTC) FILETIME=[38E18750:01C8F675] X-Virus-Checked: Checked by ClamAV on apache.org Ignore the "pom.xml" in there - that should have been something.properties. -----Original Message----- From: EJ Ciramella [mailto:ejciramella@upromise.com]=20 Sent: Monday, August 04, 2008 4:32 PM To: Ant Developers List Subject: RE: Loading interdependent properties files WAS RE: Trying (and failing) to build the nightly snapshot Actually, after thinking about this again with a full stomach, why not after properties are loaded fully expand them (if there is a value)? I know the following is very simplistic but just humor me, what if this were directly in loadFile(): Properties props =3D new Properties(); try=20 { props.load(new FileInputStream("pom.xml")); String oprop; String iprop; for (Enumeration outer =3D props.elements() ; = outer.hasMoreElements() ;)=20 { oprop=3Douter.nextElement().toString(); if(props.getProperty(oprop).contains("${")) { for (Enumeration inner =3D props.elements() ; inner.hasMoreElements() ;)=20 { iprop=3Dinner.nextElement().toString(); if(!props.getProperty(iprop).contains("${")) { props.setProperty(oprop, iprop); } } } } } -----Original Message----- From: EJ Ciramella [mailto:ejciramella@upromise.com]=20 Sent: Monday, August 04, 2008 12:56 PM To: Ant Developers List Subject: RE: Loading interdependent properties files WAS RE: Trying (and failing) to build the nightly snapshot Actually, there's a much more elegant solution. The core of the issue is the property value NOT existing at the time property file load. So here's what we're going to do: 1 - Load the property files in the order we'd like using the kinda thing. 2 - use 3 - Load final.properties. This gives us the order in which we'd like to load the properties AND full expansion of any ${} type properties. Thought I'd share. -----Original Message----- From: EJ Ciramella [mailto:ejciramella@upromise.com]=20 Sent: Monday, August 04, 2008 12:18 PM To: Ant Developers List Subject: RE: Loading interdependent properties files WAS RE: Trying (and failing) to build the nightly snapshot Right - I meant to ask, is that possible to do? I'm digging around the documentation and it's unclear if I can do: ..... Kinda thing... -----Original Message----- From: Matt Benson [mailto:gudnabrsam@yahoo.com]=20 Sent: Monday, August 04, 2008 11:42 AM To: Ant Developers List Subject: RE: Loading interdependent properties files WAS RE: Trying (and failing) to build the nightly snapshot --- EJ Ciramella wrote: > How does ant choose which properties take > precedence? >=20 > So say db.port is defined in three properties files > (default.properties, > stack.properties and machine.properties). >=20 > Generally, we'd load them in this order: >=20 > Machine.properties > Stack.properties > Default.properties >=20 > Developers re-use default.properties, the stack > generally uses a certain > port and finally, a particular machine (say a > secondary machine) would > use a third variation. >=20 > How would that loadproperties task choose which one > takes precedence? That would depend on how you assembled the concatenated resource, I suppose. -Matt >=20 > -----Original Message----- > From: Matt Benson [mailto:gudnabrsam@yahoo.com]=20 > Sent: Monday, August 04, 2008 10:40 AM > To: Ant Developers List > Subject: Loading interdependent properties files WAS > RE: Trying (and > failing) to build the nightly snapshot >=20 >=20 > --- EJ Ciramella wrote: >=20 > > Right - in an ideal world, sure.=20 > >=20 > > We're using ant for deployments and the first file > > is the MOST specific > > file, the secondary one is the more generic file. > >=20 > > So, in a nutshell, we can't alter the order of the > > property files. > >=20 > > What is interesting though is if all the > properties > > are in the SAME > > file, there's no problem (as all the expansion can > > happen at once). Can > > I do something with concat? or > > something? > >=20 > > If concat could do something like, "first found > > takes precedence but in > > general add all the properties" that would be > > perfect... > >=20 >=20 > In Ant 1.7.x, if you can "bundle" all your files, > you > should be able to them. >=20 > HTH, > Matt >=20 > > -----Original Message----- > > From: Steve Loughran [mailto:stevel@apache.org]=20 > > Sent: Monday, August 04, 2008 9:48 AM > > To: Ant Developers List > > Subject: Re: Trying (and failing) to build the > > nightly snapshot > >=20 > > EJ Ciramella wrote: > > > I think I misunderstood this particular bug. It > > appears to be a > > problem > > > with $${someprop} versus loading two property > > files and the first one > > > containing a ${property} that is set in the > second > > one loaded. > > >=20 > > > To be explicit, if you have two property files, > > a.properties and > > > b.properties, in the first one loaded you have a > > ${property} that is > > set > > > in b.properties, ant leaves it as ${}. > > >=20 > > > a.properties: > > >=20 > > > foo=3Dbar > > >=20 > > > coolprop=3D${foo}:${from.b.properties} > > >=20 > > >=20 > > >=20 > > >=20 > > >=20 > > > b.properties: > > >=20 > > > from.b.properties=3Dawesome > > >=20 > > >=20 > > >=20 > > >=20 > > > build.xml: > > >=20 > > > > > > > > > =20 > > > > > > This is a problem: > > ${coolprop} > > > > > > > > >=20 > > > You'll see this: > > >=20 > > > This is a problem: bar:${from.b.properties} > >=20 > > That's because property expansion takes place when > > the properties files=20 > > are loaded. If you want properties from > > b.properties, load it before=20 > > a.properties > >=20 > >=20 > >=20 > >=20 > > --=20 > > Steve Loughran =20 > > http://www.1060.org/blogxter/publish/5 > > Author: Ant in Action =20 > http://antbook.org/ > >=20 > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > dev-unsubscribe@ant.apache.org > > For additional commands, e-mail: > > dev-help@ant.apache.org > >=20 > >=20 > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > dev-unsubscribe@ant.apache.org > > For additional commands, e-mail: > > dev-help@ant.apache.org > >=20 > >=20 >=20 >=20 >=20 > =20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: > dev-unsubscribe@ant.apache.org > For additional commands, e-mail: > dev-help@ant.apache.org >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: > dev-unsubscribe@ant.apache.org > For additional commands, e-mail: > dev-help@ant.apache.org >=20 >=20 =20 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org