ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Dickon Glanville" <>
Subject single container for both <classpath> and <fileset>?
Date Thu, 10 May 2007 13:43:35 GMT
Hello all,

I need help.  In my build script, I have a path of libraries that I
need to use in multiple situations.  These situations include:

a) to be used within a <path>-like construct, like <classpath>
b) to be used within a <fileset> construct, to allow for <copy>
c) the need to be nest-able.

Now, I'm currently restrained to use only Ant 1.6.5, so I can't use
1.7.0's Resource Collections.  :-(

I though <path> was what I needed, as it satisfied (a) and (c), but it
can't be used within a <fileset>.  Therefore, I can't <copy> the
elements of the path.

I though <fileset> was what I needed, as it satisfies (a) and (b), but
I can't create a single <fileset> that contains other <fileset>s.
Why?  I don't know.  Why do I need it?  I'm using a <macrodef> to
define a single action to be reused several times.  One of the
attributes of this macro is the dependent libraries (gets used in the
classpath of the <javac> task, and then gets <copy>ed to a
destination).  So, the task calling the macro needs to concatenate all
dependent filesets into a single fileset so it can be passed to the
macro.  (The macro can't know the number of filesets in all
situations, so it only allows one fileset.)

I though <patternset> would solve my problems, but if the patternset
contains an entry that's a relative path that dips below the
containing <fileset>'s "dir" attribute, then the <fileset> ignores it.
 For example,
  <patternset id="pattern">
    <include name="../../tools/library.jar" />
  <fileset dir=".">
    <patternset refid="pattern" />
the resulting fileset would not have the library.jar file included in
it.  Many of my 3rd party libraries are outside of the current
ant-tree, so this happens quite frequently.

I tried the ant-contrib task <pathtofileset>, but it has the same
problem as <patternset>: it ignores files that aren't under the 'dir'

So, <path>, <fileset>, <patternset> and <pathtofileset> don't work
me.  Is there anything that I can use to define a collection of files,
and then use that collection inside <classpath> and <copy> tasks,
within ant 1.6.5?

Thanks in advance.

Jay Dickon Glanville

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message