I found a solution. Another one. ftp://yelstream.org/pub/Slice%20Extension%20Set%20for%20Apache%20Ant/1.3/
It basically repeats "org.apache.tools.ant.Project.replaceProperties()" until nothing new happens. There is a manual-thingy on ftp://yelstream.org/pub/Slice%20Extension%20Set%20for%20Apache%20Ant/1.3/Sli ce-User-Manual.pdf - page 16 has the new "property-expand" task. (I do notice that the example is not really good; it exactly misses the difference from "propertycopy") For those who care, source-code exists - see "org.yelstream.J2SE.lib.Slice.PropertyExpandTask". (If you happen to fail to FTP-connect.... well, my line to the internet is kind of thin - try later, then - an "exponential back-off"-algorithm should work!) The task appears to work as intended. ! Med venlig hilsen Morten Sabroe Mortensen TietoEnator A/S, Ved Lunden 12, 8230 Åbyhøj, Danmark mailto:[EMAIL PROTECTED] http://www.tietoenator.com -----Original Message----- From: Dominique Devienne [mailto:[EMAIL PROTECTED] Sent: 23. juli 2003 21:46 To: 'Ant Developers List'; '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: Q: Double-expansion - reading environment variables "dynamica lly" ? Output your property to a properties file (<properfile>), then read that same property file back in using <property>, but using a prefix (so has to rename the properties on the fly since Ant properties are immutable), and you now have prefixed properties with all variables expanded. Not ideal, but two lines, and works. --DD > -----Original Message----- > From: Morten Mortensen [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 23, 2003 2:40 PM > To: 'Ant Developers List'; '[EMAIL PROTECTED]' > Cc: '[EMAIL PROTECTED]' > Subject: RE: Q: Double-expansion - reading environment variables "dynamica > lly" ? > > > Hi Eric & All, > > Yes, there is no reason to be impatient. > > To the best of my knowledge, "propertycopy" can not handle it - not by > itself. > The "propertycopy" task works *iff* the "from"-attribute-value is the name > of a property. In my case, it is not. > > What I really want is not simply "property-expansion", but "expansion of > properties within a string" - I over-simplified the question, I think. > > My input is read externally (actually by a custom task). An example of the > input is the string "file://localhost/${env.XXX_HOME}/aaa/bbb/ccc". This > ends up as the value of a property. > > To use the "propertycopy" task, it is necessary to search for the > delimiters > '${' and '}' (the delimiters can in principle be anything; the input-file > can be in Ant-property-syntax, but logically, it is not), pick the string > "env.XXX_HOME" and use this value as the "from"-attribute-value. Or doing > it > "in reverse" by replacing the sub-string up until and including the > start-delimiter with the empty string and the same starting with the > end-delimiter... - leaving the "env.XXX_HOME" or whatever alone for > "propertycopy" to handle. > > The "propertycopy" task has a more powerfull super-variant, which is > capable > of more (replacing "iff" with "if"). > > Am I missing something here? > > ----- > > Which part of the API performs "property-expansion"? > > -Does there exist a method taking a string like > "file://localhost/${env.XXX_HOME}/aaa/bbb/ccc" as input and returning the > expanded string - should have the exact same effect at litterally writing > - > > <property > name="myProperty" > value="file://localhost/${env.XXX_HOME}/aaa/bbb/ccc" > /> > > ? > > "org.apache.tools.ant.Project.replaceProperties()" is the right thing? > > Does there exist an explanation of the concept of "Properties", > "SystemProperties" and "UserProperties" relative to the API somewhere - > and > where are environment-variables included? -Should just inspect the > source-code? Is the differentiation deprecated stuff? > > (the last part of the "propertycopy"-impl is fun - it differentiates > between > setting a "property" and a "user-property") > > ----- > > Regards, > Morten Sabroe Mortensen > TietoEnator A/S, Ved Lunden 12, 8230 Åbyhøj, Danmark > mailto:[EMAIL PROTECTED] > http://www.tietoenator.com > > > -----Original Message----- > From: Erik Hatcher [mailto:[EMAIL PROTECTED] > Sent: 7. juli 2003 13:24 > To: Ant Developers List > Subject: Re: Q: Double-expansion - reading environment variables > "dynamically" ? > > > <propertycopy> from the ant-contrib project at Sourceforge is what you > want. > > Erik > > p.s. No need to get impatient after less than a day of posting to the > user list, especially on a weekend. Not to mention that this has been > answered numerous times on the list and the answer is surely in the > archives and most likely at the jGuru Ant FAQ, and also in the Java > Development With Ant book. > > On Sunday, July 6, 2003, at 10:56 AM, Morten Mortensen wrote: > > > > Hi developers, > > > > I seem to have zero luck on the users-list... I am getting pretty > > impatient... > > > > To repeat: Given a defined property assigned the name of an > > environment-variable, how do I read the value of the > > environment-variable? > > > > Can it be done? How? > > > > ? > > > > Regards, > > Morten Sabroe Mortensen > > > > > > -----Original Message----- > > From: Morten Mortensen > > To: 'user@ant.apache.org' > > Sent: 06-07-03 05:30 > > Subject: Q: Double-expansion - reading environment variables > > "dynamically"? > > > > > > Given a defined property "x" assigned the name of an > > environment-variable, how do I read the value of the > > environment-variable? > > > > > > I can read the environment-variable "XXX_HOME" by introducing the > > environment as "env" and using "${env.XXX_HOME}" in my Ant-file. > > > > But what if "XXX_HOME" is specified as the value of a property? > > > > > > Constructed example: > > > > <target > > name="test" > >> > > <property environment="env"/> > > > > <!-- Property wired here for the example; is to be read by other > > means: --> > > <property name="x" value="XXX_HOME"/> > > > > <!-- Gee, does some kind of double-expansion work?: --> > > <property name="v" value="${env.${x}}"/> > > > > <!-- Would like to see the value identical to "${env.XXX_HOME}" > > here: --> > > <echo>Result: ${v}</echo> > > </target> > > > > > > If anyone knows how to do this, please tell me how. > > > > ? > > > > Morten Sabroe Mortensen > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]