ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Stockall <>
Subject Re: Ant Task and paths
Date Sun, 23 Feb 2003 16:50:00 GMT
On Sunday, February 23, 2003, at 11:31 AM, David Corbin wrote:
>> If you use a relative path then Ant will resolve the path based on 
>> what ${basedir} is set to. i.e.
> How?  Do you mean ant will do that using the FileUtils you mentioned?  
> Otherwise, I don't see how Ant will know that a given 
> attribute/property is a filesystem reference.

Ant 'knows' it's a file system reference because the task requires it, 
for example in the <jar> task the 'destdir' attribute must be a 
reference to a file, the setter in is 'setDestfile(File 
jarFile)' If you specify something that can't be resolved to a file, 
the task will fail.

> When I spoke about absolute paths, what I meant was this:  as the 
> writer of the build.xml, I can convert all relative paths by an 
> explicit reference to ${basedir}.  What I was unsure of, was if 
> requireing this was standard behavior for tasks, or not.   Apparently 
> not.

There is no need to reference ${basedir} when defining your properties.

Assume build.xml lives in c:\source

<project name="myproj" basedir=".">
	<property name="mypath" value="build/lib"/>

The ${mypath} property will be resolved to c:\source\build\lib when it 
is used in a task that requires a file or directory

Jesse Stockall -
CRYPTOCard Corp.

View raw message