You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Issam Aib <ia...@bbcr.uwaterloo.ca> on 2006/02/01 18:37:46 UTC

Property file - How to specify the "location" attribute

Hi all,

I am kind of novice in ant.

I have a difficulty to find out how to specify the “location” attribute of a property when I define it in a property file.
For example, suppose the current ${basedir} is equal to “c:\projectname\app” and I define this property in the build.xml (located at ${basedir} of course):

<property name="project.dir" location="${basedir}/.." /> 

This property definition resolves correctly to the path of the parent folder of the current ant build file. That is, to “c:\projectname”.

If I try to move this property definition to a property file I would write:

Project.dir=${basedir}/..

However, this does not resolve to what I want as it resolves to:
“c:\projectname\app/..”

This means that the property definitions in the property file are understood as a “value” attribute of a property definition and not a “location” attribute. 

Does any one know how to solve this issue?

Thanks,
Issam


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Property file - How to specify the "location" attribute

Posted by Issam Aib <ia...@bbcr.uwaterloo.ca>.
Thanks Stefan

I finally used the import task and it is working fine.

Cheers,
Issam

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
> Sent: February 2, 2006 12:06 AM
> To: user@ant.apache.org
> Subject: Re: Property file - How to specify the "location" attribute
> 
> On Wed, 1 Feb 2006, Issam Aib <ia...@bbcr.uwaterloo.ca> wrote:
> 
> > For example, suppose the current ${basedir} is equal to
> > “c:\projectname\app” and I define this property in the build.xml
> > (located at ${basedir} of course):
> 
> Minor nit: ${basedir} and the directory containing build.xml are
> independent of each other.
> 
> > <property name="project.dir" location="${basedir}/.." />
> 
> is the same as <property name="project.dir" location="${basedir}/.." />
> since all relative paths are relative to ${basedir}, Ant will take
> care of them for you.
> 
> > This means that the property definitions in the property file are
> > understood as a “value” attribute of a property definition and not
> > a “location” attribute.
> 
> Most of the time this is no big deal since Ant will resolve the path
> in many places when you actually use the property.  If you run into
> problems with the properties use <xmlproperty> and semantic attributes
> instead of a properties file.
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Property file - How to specify the "location" attribute

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 1 Feb 2006, Issam Aib <ia...@bbcr.uwaterloo.ca> wrote:

> For example, suppose the current ${basedir} is equal to 
> “c:\projectname\app” and I define this property in the build.xml
> (located at ${basedir} of course):

Minor nit: ${basedir} and the directory containing build.xml are
independent of each other.

> <property name="project.dir" location="${basedir}/.." /> 

is the same as <property name="project.dir" location="${basedir}/.." />
since all relative paths are relative to ${basedir}, Ant will take
care of them for you.

> This means that the property definitions in the property file are
> understood as a “value” attribute of a property definition and not
> a “location” attribute.

Most of the time this is no big deal since Ant will resolve the path
in many places when you actually use the property.  If you run into
problems with the properties use <xmlproperty> and semantic attributes
instead of a properties file.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org