You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Webb, James" <ja...@vignette.com> on 2001/05/02 01:11:50 UTC

v1.3 -- problems retrieving properties from

Are there any known issues in 1.3 or config tricks for 
retrieving properties from a properties file?
I have not seen any bugreports or patches for this kind
of issue.

I am trying to set up a properties file containing
local configuration such as paths,etc. for each developer's
specific environment.

/bldenv	
	./build.xml --> main buildfile common to all developers
	./local.properties --> specific for each developer env
	

Things I have tried in my build.xml

1. using...
	<property file="local.properties"/>

   results in...
	while in verbose mode when i echo any property 
	contained within the file it says...
			
	"Property ${weblogic.install.home} has not been set"
		
	I have also tested the property value with
	the <mail> task and the <mkdir> task so I am 
	certain my problem is in the <property> task
	and not in <echo>.
	
2. using...

	<property resource="local.properties"/>
	and placing the file in my CLASSPATH

   results...
	I get the same result as before.

3.   I have tried three different properties files
	to make certain it was not an encoding issue.
	This did not solve my problem.

4.   My only workaround is to set these properties as
	environment variables and grab them via
	<property environment="MYENV"/>
	I can get this to work but it is not as clean.

Ant Version: 1.3
OS: Windows 2000
JDK: Sun 1.3.0_02


Any help would be greatly appreciated.


James Webb

Re: v1.3 -- problems retrieving properties from

Posted by Anuj Agrawal <ag...@lucent.com>.
how are you setting the properties?
assuming they are being set in the local.properties file, they should appear as:

# e.g.
weblogic.install.home=c:/whatever/the/path/is

Anuj.

"Webb, James" wrote:

> Are there any known issues in 1.3 or config tricks for
> retrieving properties from a properties file?
> I have not seen any bugreports or patches for this kind
> of issue.
>
> I am trying to set up a properties file containing
> local configuration such as paths,etc. for each developer's
> specific environment.
>
> /bldenv
>         ./build.xml --> main buildfile common to all developers
>         ./local.properties --> specific for each developer env
>
>
> Things I have tried in my build.xml
>
> 1. using...
>         <property file="local.properties"/>
>
>    results in...
>         while in verbose mode when i echo any property
>         contained within the file it says...
>
>         "Property ${weblogic.install.home} has not been set"
>
>         I have also tested the property value with
>         the <mail> task and the <mkdir> task so I am
>         certain my problem is in the <property> task
>         and not in <echo>.
>
> 2. using...
>
>         <property resource="local.properties"/>
>         and placing the file in my CLASSPATH
>
>    results...
>         I get the same result as before.
>
> 3.   I have tried three different properties files
>         to make certain it was not an encoding issue.
>         This did not solve my problem.
>
> 4.   My only workaround is to set these properties as
>         environment variables and grab them via
>         <property environment="MYENV"/>
>         I can get this to work but it is not as clean.
>
> Ant Version: 1.3
> OS: Windows 2000
> JDK: Sun 1.3.0_02


Re: v1.3 -- problems retrieving properties from

Posted by Conor MacNeill <co...@cognet.com.au>.
From: "Diane Holt" <ho...@yahoo.com>
> --- Nico Seessle <ni...@apache.org> wrote:
> > > (Maybe this should go in the FAQ.)
> > >
> > The better place would be Bugzilla with a little testcase :-) So we can
> > fix that and don't need to describe wrong behaviour...
>
> As I recall, it may not be fixable -- I think it has to do with the order
> in which properties get set. That is, if you have something like:
>
> root.dir=/my/tree
> out.dir=${root.dir}/classes
>
> you will likely get a log message saying that property root.dir isn't
set.
> Conor could probably explain it in more detail.
>

OK, when reading in from a properties file, you can ignore this message :-)

What happens is this:

The properties are read in as a Properties object. They are then read out
with an enumeration and added to Ant's collection of properties. The order
of properties returned by that enumeration is, in general, not the same as
the order of the properties in the file. So, there may effectively be
forward references in the order returned by the enumeration. When this
occurs, Ant will print this message but then resolve the forward reference
within the properties object from the properties file.

In other words, properties in a properties file are more declarative than
those in a build file :-).

Now I agree that the warning there is a problem. The reason I left it in,
however, is that it is generally very difficult to catch use of properties
which are not set. I'll probably get rid of it now.

So, to the original poster, if you ignore the messages, can you check that
the values are actually being set correctly.

Sorry for the confusion.

Conor



Re: v1.3 -- problems retrieving properties from

Posted by Diane Holt <ho...@yahoo.com>.
--- Nico Seessle <ni...@apache.org> wrote:
> > (Maybe this should go in the FAQ.)
> >
> The better place would be Bugzilla with a little testcase :-) So we can
> fix that and don't need to describe wrong behaviour...

As I recall, it may not be fixable -- I think it has to do with the order
in which properties get set. That is, if you have something like:

root.dir=/my/tree
out.dir=${root.dir}/classes

you will likely get a log message saying that property root.dir isn't set.
Conor could probably explain it in more detail.

Diane


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Re: v1.3 -- problems retrieving properties from

Posted by Nico Seessle <ni...@apache.org>.
----- Original Message -----
From: "Diane Holt" <ho...@yahoo.com>
To: <an...@jakarta.apache.org>
Sent: Wednesday, May 02, 2001 4:09 AM
Subject: Re: v1.3 -- problems retrieving properties from <property
file="SOMEF ILE">


> Not exactly. The properties do get set -- the known issue is that it's
> just the log message you get when running -verbose that says it doesn't. I
> think it only happens when you build up a property based on the value of
> earlier properties, but I haven't tested it to say for certain that's
> true. In any case, you can ignore the message, so long as the properties
> have the correct value once you're actually executing targets.
>
> (Maybe this should go in the FAQ.)
>
The better place would be Bugzilla with a little testcase :-) So we can fix
that and don't need to describe wrong behaviour...

Nico



Re: v1.3 -- problems retrieving properties from

Posted by Diane Holt <ho...@yahoo.com>.
--- "Webb, James" <ja...@vignette.com> wrote:
> Are there any known issues in 1.3 or config tricks for 
> retrieving properties from a properties file?
> I have not seen any bugreports or patches for this kind
> of issue.

Not exactly. The properties do get set -- the known issue is that it's
just the log message you get when running -verbose that says it doesn't. I
think it only happens when you build up a property based on the value of
earlier properties, but I haven't tested it to say for certain that's
true. In any case, you can ignore the message, so long as the properties
have the correct value once you're actually executing targets.

(Maybe this should go in the FAQ.)

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/