ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Supriya Saha" <ss...@bowcutter.com>
Subject RE: accessing properties from external file
Date Wed, 22 Aug 2001 17:59:46 GMT
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:Anthony@WeddingChannel.com]
Sent: Wednesday, August 22, 2001 1:36 PM
To: ant-user@jakarta.apache.org
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


Mime
View raw message