ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Modin <dam...@handelsbanken.se>
Subject Ang. AW: Read property based on another property
Date Fri, 13 Mar 2009 15:27:14 GMT
OK, thanks Jan - i think i will follow your suggestion.





<Jan.Materne@rzf.fin-nrw.de> 
2009-03-13 14:26
Sänd svar till
"Ant Users List" <user@ant.apache.org>


Till
<user@ant.apache.org>
Kopia

Ärende
AW: Read property based on another property






>In file "deploy.properties" i would like to have properties for deploy 
>directories for different test environments:
>deploy.dir.ft = ft/stage/2
>deploy.dir.st =st/stage/2
>deploy.dir.pt =st/stage/2
>deploy.dir.pr=pr/stage/1
>
>Then i want to read the deploy directory for the current 
>testenvironment!
>
>I tried this:
>
>    <ftp server="ftpserver"
>         remotedir="${deploy.dir.${testenv}}"
>             :
>             :
>   </ftp>
>
>....and offcause it did not work :-)


Your solution is described in the FAQ
http://ant.apache.org/faq.html#propertyvalue-as-name-for-property

I would suggest using multiple properties files
  <property name="environment" value="ft"/> <!-- ft, st, pt, pr ... -->
  <property file="environment.${environment}.properties"/>
With stored properties eg in environment.ft.properties
  deploy.dir=ft/stage/2
  ftp.user=...
  ftp.pwd=...
  ftp.server=...
Same properties (but different values) in the other files.
The simply use
  <ftp server="${ftp.server}" remotedir="${deploy.dir}" ...


Jan


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



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message