You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Daniel Barclay <Da...@digitalfocus.com> on 2001/05/10 21:58:19 UTC

does Ant work with absolute file pathnames?

Are the various tasks in Ant compatible with using absolute file pathnames?

I've been running into a number of places where tasks expect a file pattern 
but don't seem to work with absolute file pathnames.

For example, I'm trying to do something like this:

  in project\module2\build.xml:

  <war ... >
    ...
    <lib dir="."
      <include name="${module1.jarName}" />
    </lib>
  </war>

The value of property module1.jarName is an absolute file pathname (e.g., 
"C:\project\module1\build\result.jar").

Because the "name" attribute of the "include" element of a FileSet-based
element (e.g., the "lib" element) is a file pattern, absolute pathnames 
don't seem to work.

Is there any way to specify an absolute pathname?

If not, is there a design flaw in Ant that many of its tasks don't
handle absolute pathnames?  Or must Ant be used with relative pathnames?
Or do you have to define more properties (to split some parent or
ancestor directory name from the remainder of the pathname of a file)?


Thanks,
Daniel
-- 
Daniel Barclay
Digital Focus
Daniel.Barclay@digitalfocus.com

Re: does Ant work with absolute file pathnames?

Posted by Stefan Bodewig <bo...@apache.org>.
Daniel Barclay <Da...@digitalfocus.com> wrote:

> Are the various tasks in Ant compatible with using absolute file
> pathnames?

Yes, in theory.  What doesn't work very well is collecting files with
and absolute path into a fileset on systems that don't have a single
rooted file system.

On Unix

>     <lib dir="."
>       <include name="${module1.jarName}" />
>     </lib>

works for absolute paths as well, if you set dir to "/" - at least I
think it does.  We need to find a workaround for Windows, OS/2 and
probably others (VMS), but it is not there ATM.

> Or do you have to define more properties (to split some parent or
> ancestor directory name from the remainder of the pathname of a
> file)?

Until there is a better solution, yes.

Stefan