You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Dmitri Colebatch <di...@bigpond.net.au> on 2001/10/04 01:19:13 UTC

ant Project..getUserProperties() (fwd)

Hi list,

I've had a bit of a look in the archives with no success for this, but if
I should be looking somewhere, be happy to be told (o:

I'm one of the developers in XDoclet, and am trying to extract properties
from ant.  In one my execute method (well, a method called by the execute
method), I have the following code:

		Hashtable userProperties =
getOwningTarget().getProject().getUserProperties();
		Enumeration keys = userProperties.keys();
		while( keys.hasMoreElements() )
		{
			Object key = keys.nextElement();
			System.out.println( "[" + key + "=" +
userProperties.get( key ) + "]" );
		}

which I expect to see all the properties set using the <property>
task.  However, all I get is:

[ejbdoclet]
[ant.file=/export/home/dim/cvs/xdoclet/core/samples/script/build.xml]
[ejbdoclet] [ant.project.name=Test]
[ejbdoclet] [ant.version=Ant version 1.4 compiled on September 3 2001]

The build file is fairly normal, I have an init target with all the
properties which the ejbdoclet target (where this is executed) depends
on.  I see the init target go through in the output...

any ideas what I'm doing wrong? 

cheers
dim


Re: ant Project..getUserProperties() (fwd)

Posted by Dmitri Colebatch <di...@bigpond.net.au>.
thanks for the response.  

I tried that first, and got a lenthy list of properties, but didn't get
any of the properties I had set.  I will double check this to be
sure.

I think userProperties is right from what I can see of the property task
code.  It seems to basically set a user property.

cheers
dim

On Wed, 3 Oct 2001, Erik Hatcher wrote:

> Dmitri,
> 
> I believe you want to use getProperties rather than getUserProperties.
> 
>     Erik
> 
> 
> ----- Original Message ----- 
> From: "Dmitri Colebatch" <di...@bigpond.net.au>
> To: <an...@jakarta.apache.org>
> Sent: Wednesday, October 03, 2001 4:19 PM
> Subject: ant Project..getUserProperties() (fwd)
> 
> 
> > Hi list,
> > 
> > I've had a bit of a look in the archives with no success for this, but if
> > I should be looking somewhere, be happy to be told (o:
> > 
> > I'm one of the developers in XDoclet, and am trying to extract properties
> > from ant.  In one my execute method (well, a method called by the execute
> > method), I have the following code:
> > 
> > Hashtable userProperties =
> > getOwningTarget().getProject().getUserProperties();
> > Enumeration keys = userProperties.keys();
> > while( keys.hasMoreElements() )
> > {
> > Object key = keys.nextElement();
> > System.out.println( "[" + key + "=" +
> > userProperties.get( key ) + "]" );
> > }
> > 
> > which I expect to see all the properties set using the <property>
> > task.  However, all I get is:
> > 
> > [ejbdoclet]
> > [ant.file=/export/home/dim/cvs/xdoclet/core/samples/script/build.xml]
> > [ejbdoclet] [ant.project.name=Test]
> > [ejbdoclet] [ant.version=Ant version 1.4 compiled on September 3 2001]
> > 
> > The build file is fairly normal, I have an init target with all the
> > properties which the ejbdoclet target (where this is executed) depends
> > on.  I see the init target go through in the output...
> > 
> > any ideas what I'm doing wrong? 
> > 
> > cheers
> > dim
> > 
> > 
> 
> 


Re: ant Project..getUserProperties() (fwd)

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Dmitri,

I believe you want to use getProperties rather than getUserProperties.

    Erik


----- Original Message ----- 
From: "Dmitri Colebatch" <di...@bigpond.net.au>
To: <an...@jakarta.apache.org>
Sent: Wednesday, October 03, 2001 4:19 PM
Subject: ant Project..getUserProperties() (fwd)


> Hi list,
> 
> I've had a bit of a look in the archives with no success for this, but if
> I should be looking somewhere, be happy to be told (o:
> 
> I'm one of the developers in XDoclet, and am trying to extract properties
> from ant.  In one my execute method (well, a method called by the execute
> method), I have the following code:
> 
> Hashtable userProperties =
> getOwningTarget().getProject().getUserProperties();
> Enumeration keys = userProperties.keys();
> while( keys.hasMoreElements() )
> {
> Object key = keys.nextElement();
> System.out.println( "[" + key + "=" +
> userProperties.get( key ) + "]" );
> }
> 
> which I expect to see all the properties set using the <property>
> task.  However, all I get is:
> 
> [ejbdoclet]
> [ant.file=/export/home/dim/cvs/xdoclet/core/samples/script/build.xml]
> [ejbdoclet] [ant.project.name=Test]
> [ejbdoclet] [ant.version=Ant version 1.4 compiled on September 3 2001]
> 
> The build file is fairly normal, I have an init target with all the
> properties which the ejbdoclet target (where this is executed) depends
> on.  I see the init target go through in the output...
> 
> any ideas what I'm doing wrong? 
> 
> cheers
> dim
> 
> 


Re: ant Project..getUserProperties() (fwd)

Posted by Dmitri Colebatch <di...@bigpond.net.au>.
)o:  thanks.  I had looked at the setProperty method in the Property task
a little too quickly and missed the meaning of it.

cheesr
dim

On Wed, 3 Oct 2001, Diane Holt wrote:

> Looks like getUserProperties() will get you ant.file, ant.project.name,
> and ant.version, along with any properties defined on the command-line;
> getProperties() will get those set with the <property> tag (along with all
> the system ones as well).
> 
> Diane
> 
> --- Dmitri Colebatch <di...@bigpond.net.au> wrote:
> > Hi list,
> > 
> > I've had a bit of a look in the archives with no success for this, but
> > if
> > I should be looking somewhere, be happy to be told (o:
> > 
> > I'm one of the developers in XDoclet, and am trying to extract
> > properties
> > from ant.  In one my execute method (well, a method called by the
> > execute
> > method), I have the following code:
> > 
> > 		Hashtable userProperties =
> > getOwningTarget().getProject().getUserProperties();
> > 		Enumeration keys = userProperties.keys();
> > 		while( keys.hasMoreElements() )
> > 		{
> > 			Object key = keys.nextElement();
> > 			System.out.println( "[" + key + "=" +
> > userProperties.get( key ) + "]" );
> > 		}
> > 
> > which I expect to see all the properties set using the <property>
> > task.  However, all I get is:
> > 
> > [ejbdoclet]
> > [ant.file=/export/home/dim/cvs/xdoclet/core/samples/script/build.xml]
> > [ejbdoclet] [ant.project.name=Test]
> > [ejbdoclet] [ant.version=Ant version 1.4 compiled on September 3 2001]
> > 
> > The build file is fairly normal, I have an init target with all the
> > properties which the ejbdoclet target (where this is executed) depends
> > on.  I see the init target go through in the output...
> > 
> > any ideas what I'm doing wrong? 
> > 
> > cheers
> > dim
> > 
> 
> 
> =====
> (holtdl@yahoo.com)
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
> http://geocities.yahoo.com/ps/info1
> 


Re: ant Project..getUserProperties() (fwd)

Posted by Diane Holt <ho...@yahoo.com>.
Looks like getUserProperties() will get you ant.file, ant.project.name,
and ant.version, along with any properties defined on the command-line;
getProperties() will get those set with the <property> tag (along with all
the system ones as well).

Diane

--- Dmitri Colebatch <di...@bigpond.net.au> wrote:
> Hi list,
> 
> I've had a bit of a look in the archives with no success for this, but
> if
> I should be looking somewhere, be happy to be told (o:
> 
> I'm one of the developers in XDoclet, and am trying to extract
> properties
> from ant.  In one my execute method (well, a method called by the
> execute
> method), I have the following code:
> 
> 		Hashtable userProperties =
> getOwningTarget().getProject().getUserProperties();
> 		Enumeration keys = userProperties.keys();
> 		while( keys.hasMoreElements() )
> 		{
> 			Object key = keys.nextElement();
> 			System.out.println( "[" + key + "=" +
> userProperties.get( key ) + "]" );
> 		}
> 
> which I expect to see all the properties set using the <property>
> task.  However, all I get is:
> 
> [ejbdoclet]
> [ant.file=/export/home/dim/cvs/xdoclet/core/samples/script/build.xml]
> [ejbdoclet] [ant.project.name=Test]
> [ejbdoclet] [ant.version=Ant version 1.4 compiled on September 3 2001]
> 
> The build file is fairly normal, I have an init target with all the
> properties which the ejbdoclet target (where this is executed) depends
> on.  I see the init target go through in the output...
> 
> any ideas what I'm doing wrong? 
> 
> cheers
> dim
> 


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



__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1