ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hagen, Christian" <cha...@init-ka.de>
Subject AW: ANT 1.5.1: Two property files: Property values not resolved
Date Tue, 11 Feb 2003 15:05:46 GMT
Well, I just found a simple solution:

I can use the "loadproperties" task with a "linecontains" filterchain to only read the "P.refid"
from the first (abc.P.properties) file, then read the according "${P.refid}.C.properties"
and then the first file again. It works just fine!

Greeting
Chris

> -----Urspr√ľngliche Nachricht-----
> Von: Hagen, Christian [mailto:chagen@init-ka.de]
> Gesendet: Dienstag, 11. Februar 2003 15:43
> An: Ant Users List
> Betreff: AW: ANT 1.5.1: Two property files: Property values 
> not resolved
> 
> 
> Ok, I obviously got something wrong. Not even this works:
> 
> <project basedir="." default="show" name="">
> 
>     <target name="init">
>       <property name="base" value="basepath"/>
>       <property name="one" value="${base}/${two}/${three}"/>
>       <property name="two" value="twovalue"/>
>       <property name="three" value="threevalue"/>
>     </target>
>     
>     <target name="show" depends="init">
>       <echo message="base    : ${base}"/>
>       <echo message="one     : ${one}"/>
>     </target>
> 
> </project>
> 
> 
> 
> The output is:
> 
> Build sequence for target `show' is [init, show]
> Complete build sequence is [init, show]
> init:
> Property ${two} has not been set
> Property ${three} has not been set
> show:
> base    : basepath
> one     : basepath/${two}/${three}
> BUILD SUCCESSFUL
> 
> 
> Moving the line like this solves the problem:
> 
> <project basedir="." default="show" name="">
> 
>     <target name="init">
>       <property name="base" value="basepath"/>
>       <property name="two" value="twovalue"/>
>       <property name="three" value="threevalue"/>
> 
>       <property name="one" value="${base}/${two}/${three}"/>
> 
>     </target>
>     
>     <target name="show" depends="init">
>       <echo message="base    : ${base}"/>
>       <echo message="one     : ${one}"/>
>     </target>
> 
> </project>
> 
> 
> Output:
> 
> Complete build sequence is [init, show]
> init:
> show:
> base    : basepath
> one     : basepath/twovalue/threevalue
> BUILD SUCCESSFUL
> 
> 
> 
> Nevertheless I have got the previously mentioned files, I 
> have to deal with :-(. Are there any possibilities to prevent 
> ANT from reading all property entries when it reads the first 
> file? The entry "P.refid" would be enough, then it could read 
> the "*.C.properties" file and then the abc.P.properties file again. 
> 
> Greetings
> Chris
> 
> 
> > -----Urspr√ľngliche Nachricht-----
> > Von: Adam Hardy [mailto:adam.ant@cyberspaceroad.com]
> > Gesendet: Dienstag, 11. Februar 2003 14:07
> > An: Ant Users List
> > Betreff: Re: ANT 1.5.1: Two property files: Property values 
> > not resolved
> > 
> > 
> > Resolving the properties again would be compromising the ant 
> > properties' 
> > immutability behaviour.
> > 
> > Anyway, your references seem to be circular, even if you could 
> > re-initialise the properties.
> > 
> > Adam
> > 
> > 
> > Hagen, Christian wrote:
> > > Hi,
> > > 
> > > even searching docs and archives did not help me with the 
> > following issue:
> > > 
> > > I have got two property files:
> > > 
> > > abc.P.properties:
> > > P.refid = xyz
> > > P.display.somevalue = ABC
> > > P.display.refname = ${C.display.name}
> > > 
> > > xyz.C.properties:
> > > C.display.name = Name of XYZ
> > > 
> > > 
> > > The entry "P.refid" in "abc.P.properties" is used to 
> > resolve the name of the second property file (here: 
> > "xyz.C.properties"). The property "P.display.refname" by 
> > default references another property set in the "*.C.properties".
> > > 
> > > I do load the two property files with
> > > 
> > > <property file="abc.P.properties"/>
> > > <property file="${P.refid}.C.properties"/>
> > > 
> > > When setting verbose mode, there are warnings after the 
> > first file, that some properties (ie. "C.display.name") have 
> > not been set, which is perfectly clear.
> > > 
> > > The problem is, that after reading the second property 
> > file, I inserted some echo tasks to output the property 
> > values. The result is similar to
> > > 
> > > "P.display.refname : ${C.display.name}"
> > > 
> > > which means that the property has not been resolved.
> > > 
> > > Question: Is there any way to trigger ANT to resolve the 
> > properties again? Or should the example above work anyway?
> > > 
> > > 
> > > Thanks in advance.
> > > 
> > > Greetings
> > > Chris
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > 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
> 

Mime
View raw message