ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Max Rydahl Andersen" <...@eos.dk>
Subject Referencing to a group of filesets ?
Date Mon, 23 Sep 2002 12:11:19 GMT
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:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message