You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dwayne Schultz <dw...@schultz.net> on 2003/03/11 01:11:09 UTC

${basedir} prepended to properties?

I am writing a myproj_build.xml file that will go in a jar to help 
users use our product.  Someone started putting ${basedir} in front of 
some of the properties but I think it is unnecessary.  We have 
something like this:

	<property name="deploymentFile" value="${basedir}/conf/colle.cds"/>

It works on my system if I just remove the ${basedir}.  Can anyone 
comment on this?

Dwayne

=============================
Use the right kind of glue
http://colle.sf.net


Re: ${basedir} prepended to properties?

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
On Tue, 11 Mar 2003 11:11 am, Dwayne Schultz wrote:
> I am writing a myproj_build.xml file that will go in a jar to help
> users use our product.  Someone started putting ${basedir} in front of
> some of the properties but I think it is unnecessary.  We have
> something like this:
>
> 	<property name="deploymentFile" value="${basedir}/conf/colle.cds"/>
>
> It works on my system if I just remove the ${basedir}.  Can anyone
> comment on this?
>

It depends on what you want deploymentFile to contain and how you use the 
property. 

Using ${basedir} is not necessary. If you are passing the property value into 
Ant tasks that expect a File, it will be resolved against the basedir 
automatically. "Resolving" is slightly more sophisticated than prepending 
${basedir} since it will handle cases where the value is an absolute path , 
etc.

In some cases you want to fix the value of the property to the full path. You 
may be passing the property to a sub-build with a different basedir, for 
example. In that case you should use the form

<property name="deploymentFile" location="conf/colle.cds"/>

This will perform the resolution at the time the property is created. Check 
out the <property> task documentation.

Conor