Thank you all. I used <propety file="..."/> and it worked. On a side note,
what is the purpose of the propertyfile task? Would it be to create global
variables that different tasks could use during the build?
-Anthony
-----Original Message-----
From: Supriya Saha [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 11:00 AM
To: [EMAIL PROTECTED]
Subject: RE: accessing properties from external file
Try to use this code :
<target name="init">
<property file="c:/ant_Build/build.properties"/>
</target>
<target name="echo" depends="init">
<echo message="${name} was here"/>
</target>
Best of luck,
Supriyo
-----Original Message-----
From: Anthony Rodriguez [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 1:36 PM
To: [EMAIL PROTECTED]
Subject: accessing properties from external file
Here is my property file:
#Global properties
#Wed Aug 22 10:32:39 PDT 2001
name=anthony
Here is my test.xml file:
<?xml version="1.0"?>
<project name="test" basedir="." default="echo">
<path id="project.classpath">
<pathelement
path="c:\\ant_Build\\lib\\jakarta-ant-1.4Beta1-optional.jar"/>
</path>
<target name="init">
<propertyfile file="c:/ant_Build/build.properties" comment="Global
properties"/>
</target>
<target name="echo" depends="init">
<echo message="${name} was here"/>
</target>
</project>
Here's what I get when I run ant -v -buildfile test.xml:
Ant version 1.4Beta1 compiled on August 9 2001
Buildfile: test.xml
Detected Java version: 1.3 in: c:\jdk1.3.1\jre
Detected OS: Windows 2000
parsing buildfile C:\ant_Build\test.xml with URI =
file:C:/ant_Build/test.xml
Project base dir set to: C:\ant_Build
Build sequence for target `echo' is [init, echo]
Complete build sequence is [init, echo]
init:
[propertyfile] Updating property file: C:\ant_Build\build.properties
echo:
Property ${name} has not been set
[echo] ${name} was here
BUILD SUCCESSFUL
Total time: 1 second
My question is, how do I access values from an external properties file???
I'm using ${name} but it doesn't seem to work. Any help would be greatly
appreciated.
-Anthony