Hi!

I like the possibility to reference paths and patternsets in Ant - it makes
it easy to reuse many common data that would otherwise be redundant. But now
I have found a situation where I would REEALLY like the possibility to reuse
a group of <fileset>'s is this possible ?

My usecase is that in one scenario I wan't to use <copy> and in another I
want to use <jar> on the same set of filesets.
Current usage:
  <copy todir="build/application.ear">
    <!-- The other modules contribution -->
    <fileset dir="../client/build/hotlib" includes="client.jar/**/*"/>
    <fileset dir="../gui/build/hotlib" includes="gui.jar/**/*"/>
    <fileset dir="../model/build/hotlib" includes="model.jar/**/*"/>
    <fileset dir="../util/build/hotlib" includes="util.jar/**/*"/>
    ...
    <!-- The needed test code -->
    <fileset dir="${module.hotlib.dir}" includes="tests.jar/**/*"/>

    <!-- Configuration and additonal jars -->
    <fileset dir="${module.etc.dir}/deploy1" includes="META-INF/*.xml"/>
    <fileset dir="${junit.home}" includes="junit.jar"/>
    <fileset dir="${hsqldb.home}/lib" includes="hsqldb.jar"/>
    <fileset dir="${commons-collections.home}"
includes="commons-collections.jar"/>
   ...
</copy>

  <jar jarfile="${module.earfile}">
    <!-- The other modules contribution -->
    <fileset dir="../client/build/hotlib" includes="client.jar/**/*"/>
    <fileset dir="../gui/build/hotlib" includes="gui.jar/**/*"/>
    <fileset dir="../model/build/hotlib" includes="model.jar/**/*"/>
    <fileset dir="../util/build/hotlib" includes="util.jar/**/*"/>
    ...
    <!-- The needed test code -->
    <fileset dir="${module.hotlib.dir}" includes="tests.jar/**/*"/>

    <!-- Configuration and additonal jars -->
    <fileset dir="${module.etc.dir}/deploy1" includes="META-INF/*.xml"/>
    <fileset dir="${junit.home}" includes="junit.jar"/>
    <fileset dir="${hsqldb.home}/lib" includes="hsqldb.jar"/>
    <fileset dir="${commons-collections.home}"
includes="commons-collections.jar"/>
   ...
</jar>

As you can see the filesets in these tasks are EXACTLY the same, and I
cannot use patternsets as the basedir are not the same for all filesets ;(
And if something changes in the set one always forget to update the one or
the other.

It would be nice to just write:

<filesetgroup id="alljars">
    <!-- The other modules contribution -->
    <fileset dir="../client/build/hotlib" includes="client.jar/**/*"/>
    <fileset dir="../gui/build/hotlib" includes="gui.jar/**/*"/>
    <fileset dir="../model/build/hotlib" includes="model.jar/**/*"/>
    <fileset dir="../util/build/hotlib" includes="util.jar/**/*"/>
    ...
    <!-- The needed test code -->
    <fileset dir="${module.hotlib.dir}" includes="tests.jar/**/*"/>

    <!-- Configuration and additonal jars -->
    <fileset dir="${module.etc.dir}/deploy1" includes="META-INF/*.xml"/>
    <fileset dir="${junit.home}" includes="junit.jar"/>
    <fileset dir="${hsqldb.home}/lib" includes="hsqldb.jar"/>
    <fileset dir="${commons-collections.home}"
includes="commons-collections.jar"/>
   ...
</filesetgroup>

<copy todir="build/application.ear">
 <filesetgroup refid="alljars">
</copy>

<jar jarfile="${module.earfile}">
 <filesetgroup refid="alljars">
</jar>


Or is there something similar/better in the current Ant ?

/max


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to