You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jay Dickon Glanville <di...@gmail.com> on 2007/05/10 15:43:35 UTC

single container for both and ?

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" />
  </patternset>
  <fileset dir=".">
    <patternset refid="pattern" />
  </fileset>
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'
attribute.



So, <path>, <fileset>, <patternset> and <pathtofileset> don't work for
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.
JDG


-- 
Jay Dickon Glanville

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