ANT fetch values from properties file

ank9
ank9 used Ask the Experts™
on
I have the following ANT file

<?xml version="1.0"?>
<project name="installDar" default="build">
        <target name="build">
            <emc.install dar="../dar/cob.dar"
                         docbase="POC"
                         username="dmad"
                         password="He3"
            />
        </target>
</project>

Is is possible to fetch the values of "dicbase", "username" and "password" from a properties file rather than writing them in XML file. That way each environment can have it's own properties file and we'll not have to maintain separate XML for each environment

Thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2009
Commented:
I usually write a properties file by the the name of build.properties in the same directory as the ant file.
Example.

user=a
password=b

Withiin the ant file I would access them as $user or $password.
Top Expert 2016
Commented:
Use

<property file="x.properties"/>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial