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

标签 ant jarjar

我目前有这个:

<jarjar destfile="a.jar" manifest="Manifest.mf">
  <zipfileset src="first.jar"/>
  <zipfileset src="second.jar"/>
</jarjar>

问题是我必须手动指定每个 jar,因为我需要考虑 src 参数。我想要这样的东西:
<zipfileset>
   <include name="*.jar"/>
<zipfileset>

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

最佳答案

也许您可以先将 jar 与以下内容合并:

<zip destfile="out.jar">
  <zipgroupfileset dir="lib" includes="*.jar"/>
</zip>

并在 zipfileset 中指定合并的 jar。

zipgroupfileset

A <zipgroupfileset> allows for multiple zip files to be merged into

the archive. Each file found in this fileset is added to the archive the same way that zipfileset src files are added.

<zipgroupfileset> is a fileset and supports all of its attributes and

nested elements.

关于ant - 如何使用 zipfileset src 属性而不必为我的所有 jar 手动指定它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6291525/

相关文章:

java - 使用 SonarQube Ant 任务进行分析

ant - 使用 Jar Jar 链接排除空目录

maven - 如何使用 Maven 创建 JarJar'd Artifact ,其中使用 Artifact 不会拉取传递依赖关系?

java - Android:包含/重新打包引用 javax 核心类的依赖项时出错

Ant xmlproperty 任务由于验证错误而失败

ant - 使用 ant 列出所有文件和子目录

ant - 如何在ant脚本中调用ant.exe路径

java - 运行 ant run 命令时获取 "Process fork failed"