OK, thanks Jan - i think i will follow your suggestion.




<[email protected]> 
2009-03-13 14:26
Sänd svar till
"Ant Users List" <[email protected]>


Till
<[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to