You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bill Burton <bi...@progress.com> on 2000/12/21 01:22:30 UTC

Re: "resource" vs. "file" in task

Hello Diane,

Diane Holt wrote:
> 
> >From the doc:
>   <property file="foo.properties" />
> reads a set of properties from a file called "foo.properties".
> 
>   <property resource="foo.properties" />
> reads a set of properties from a resource called "foo.properties".
> 
> What's the difference between a "resource" and "file"?

This confused me too as the docs aren't clear on the distinction so I
looked at the source to get the answer.  The file attribute does what you
would expect and loads a file from the file system.  The resource
attribute also loads a file but finds the file by calling
getClass().getResourceAsStream("foo.properties") causing it to be loaded
from the CLASSPATH which includes looking inside .jar's in the CLASSPATH.

-Bill Burton

> 
> Thanks,
> Diane
> 
> =====
> (holtdl@yahoo.com)

Re: "resource" vs. "file" in task

Posted by Stefan Schmitt <ss...@raleigh.ibm.com>.
----- Original Message -----
From: "Bill Burton" <bi...@progress.com>
Subject: Re: "resource" vs. "file" in <property> task

> This confused me too as the docs aren't clear on the distinction so I
> looked at the source to get the answer.

You say that the doc's aren't clear at this point. Perhaps somebody should
change the doc's at this point.

Yours
Stefan S