ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject Re: Using <property resource=...>
Date Wed, 03 Jan 2001 02:21:41 GMT
Hi Diane,

If I recall, you are using Ant 1.2 with various enhancements?

Here's a simple build.xml that tests the <property resource> functionality
by reading the version.txt file from ant.jar:

<?xml version="1.0"?>
<project name="TestResource" default="main" basedir=".">
  <!-- Lookup resources in Ant's version.txt. 
       Contains VERSION and DATE properties -->
  <property resource="org/apache/tools/ant/version.txt"/>
  <target name="main">
    <echo>
Ant version: ${VERSION}
Date compiled: ${DATE}
    </echo>
  </target>
</project>

When I run this under Ant 1.2 I get:

$ ant12 -verbose -buildfile testResource.xml
Ant version 1.2 compiled on October 24 2000

Buildfile: testResource.xml
Detected Java Version: 1.2
Detected OS: Windows NT
Project base dir set to: D:\anttest
 [property] Resource Loading org/apache/tools/ant/version.txt
Build sequence for target `main' is [main]
Complete build sequence is [main]

Ant version: ${VERSION}
Date built: ${DATE}


BUILD SUCCESSFUL

Total time: 1 second

Note that the resource is read in but the properties set within aren't
expanded.

But under 1.3alpha I get:
$ ant13 -verbose -buildfile testResource.xml
Ant version 1.3alpha compiled on December 13 2000

Buildfile: testResource.xml
Detected Java Version: 1.3
Detected OS: Windows NT
Project base dir set to: D:\anttest
 [property] Resource Loading org/apache/tools/ant/version.txt
Build sequence for target `main' is [main]
Complete build sequence is [main]
     [echo]
Ant version: 1.3alpha
Date built: December 13 2000


BUILD SUCCESSFUL

Total time: 1 second

It looks like there is a bug in version 1.2 that has been fixed in the CVS
tree.  Not sure if you could just replace Property.java to fix this.

-Bill Burton

Diane Holt wrote:
> 
> Has anyone used the <property> task with the "resource" attribute
> specified? I can't get it to do what I thought it should (ie., read in a
> properties file from a jar-file, and make those properties available for
> use). I added some print statements to Property.java to see what it was
> doing, and it looks like it fails the "if( is != null )", so I have to
> assume I'm specifying the value for "resource" incorrectly -- but I've
> tried several different ways, and none of them have worked.
> 
> Thanks,
> Diane
> 
> =====
> (holtdl@yahoo.com)

Mime
View raw message