You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by sebastian ssmoller <se...@gmx.net> on 2004/08/11 13:41:50 UTC

properties

hi,
another short question concerning <ant/> and properties .... :)

passing properties to the new project using this code snippet 

<ant ...>
	<property file="local.properties"/>
</ant>

all these properties in the "local.properties" are evaluated in the
context of the new project right?  

so a property like "deploy=${basedir}/deploy" in the
local.properties will be set relative to the basedir to the new project
rather than to the old one  - correct ?

and if i want to behave <ant/> the other way round (deploy relative to
the basedir of the calling project) i have to add all these properties
manually like this: 

<ant>
	<property name="deploy" value="${basedir}/deploy"/>
</ant>

is this the only way ? did i miss something ?


thx 
regards,
seb

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


Re: properties

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 11 Aug 2004, sebastian ssmoller <se...@gmx.net>
wrote:

> passing properties to the new project using this code snippet 
> 
> <ant ...>
> 	<property file="local.properties"/>
> </ant>
> 
> all these properties in the "local.properties" are evaluated in the
> context of the new project right?  

Yes.  Technically the property elements are <property> tasks run
inside the new project.

> so a property like "deploy=${basedir}/deploy" in the
> local.properties will be set relative to the basedir to the new
> project rather than to the old one - correct ?

It depends the values of the dir and inheritall attributes of your
<ant> task - see the table in <ant>'s manual page.  Technically it is
the basedir of the new project, but that may be different from the
<project> element's basedir attribute.

> and if i want to behave <ant/> the other way round (deploy relative
> to the basedir of the calling project) i have to add all these
> properties manually like this:

Or set the dir attribute of the <ant> task.

> did i miss something ?

Yes.

You can load the properties file in your main build file, give them a
common prefix (or make them identifiable in any other way) and use a
<propertyset> to pass them down to your subbuild.

Stefan

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