Search code examples
fileantproperties-file

ant reading key value property files


I have a property file(user.properties) like this:

ip=10.161.16.755
names={"10.161.16.75":"v1"}
adminPassword=admin
sshUserName=r
sshPassword=v
[email protected]

I want to read vc.username and names into some variables and use them later in ant. How can I achieve that?


Solution

  • You can include your properties file in your build xml

    <property file="user.properties"/>
    

    And now you can use all keys defined in your properties files like a variable. For example :

    ${vc.username} will give you [email protected]

    Hope this helps