如何使用zipfileset src属性而不必为我的所有jar手动指定它?

Geo*_*Geo 11 ant jarjar

我目前有这个:

<jarjar destfile="a.jar" manifest="Manifest.mf">
  <zipfileset src="first.jar"/>
  <zipfileset src="second.jar"/>
</jarjar>
Run Code Online (Sandbox Code Playgroud)

问题是我必须手动指定每个jar,因为我需要考虑src参数.我想要这样的东西:

<zipfileset>
   <include name="*.jar"/>
<zipfileset>
Run Code Online (Sandbox Code Playgroud)

并将其内容提取并包含在我生成的存档中.这可能吗?

oer*_*ers 14

也许你可以先将罐子合并到:

<zip destfile="out.jar">
  <zipgroupfileset dir="lib" includes="*.jar"/>
</zip>
Run Code Online (Sandbox Code Playgroud)

并在zipfileset中指定合并的jar.

zipgroupfileset

A <zipgroupfileset> allows for multiple zip files to be merged into
Run Code Online (Sandbox Code Playgroud)

档案.在此文件集中找到的每个文件都以与添加zipfileset src文件相同的方式添加到存档中.

<zipgroupfileset> is a fileset and supports all of its attributes and
Run Code Online (Sandbox Code Playgroud)

嵌套元素.


sud*_*ode 5

根据jarjar wiki的评论,你可以在你的jarjar中使用它:

<zipgroupfileset dir="lib" includes="*.jar" />
Run Code Online (Sandbox Code Playgroud)

我没试过.