如何在zip中包含受限制的文件集而不在ant中创建临时副本

时间:2021-12-04 15:06:37

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.

没有副本有没有办法做到这一点?我在想我可以创建一些具有限制的虚拟文件集,然后将其称为refid in。注意我也会把事情弄平,这可能会让事情变得更难/不可能。

1 个解决方案

#1


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

#1


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