Trenton
Trenton

Reputation: 11996

How to include restricted fileset in zip without creating an interim copy in ant

I have a fileset which contains a number of jars of which I only want a subset. I'm currently doing this:

<target name="work-around">
    <delete dir="${dir.deps}" failonerror="false" />
    <copy todir="${dir.deps}" flatten="true">
      <restrict>
        <fileset refid="mvn.deps.fileset" />
        <rsel:name name="**/mycompany-core*.jar" />
      </restrict>
    </copy>
</target>

<target name="dist" depends="work-around">
    <zip destfile="${dir.dist}/whizbang.zip">
        <zipfileset dir="${dir.deps}" prefix="deps" />        
    </zip>
</target>

Is there a way to do this without the copy? I'm thinking that I can create some type of virtual fileset which has the restriction, then refer to it as a refid in . Note I'm also flattening things, which may make it harder/impossible.

Upvotes: 1

Views: 906

Answers (1)

Philippe Carriere
Philippe Carriere

Reputation: 3720

< zipfileset exclude="excludeddir or file..."

Upvotes: 1

Related Questions