如何使用 zipfileset src 属性而无需为所有 jar 手动指定它?

发布于 2024-11-14 09:35:00 字数 370 浏览 5 评论 0原文

我目前有这个:

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

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

<zipfileset>
   <include name="*.jar"/>
<zipfileset>

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

I currently have this:

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

The problem is I have to manually specify each jar, because I need the src parameter to be taken in consideration. I would want something like this:

<zipfileset>
   <include name="*.jar"/>
<zipfileset>

And have their contents extracted and included in my resulting archive. Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

七色彩虹 2024-11-21 09:35:00

也许您可以首先使用以下命令合并 jar,

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

并在 zipfileset 中指定合并的 jar。

zipgroupfileset

A ;允许将多个 zip 文件合并到

存档。在此找到的每个文件
文件集被添加到存档中
与 zipfileset src 文件相同
添加。

;是一个文件集并支持其所有属性并且

嵌套元素。

Maybe you could merge the jars first with:

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

and specify the merged jar in the zipfileset.

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.

无风消散 2024-11-21 09:35:00

根据 jarjar wiki 上的评论,您可以在 jarjar 中使用它

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

:没试过。

According to comments on the jarjar wiki, you can use this in your jarjar:

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

I haven't tried it.

佼人 2024-11-21 09:35:00
<jar destfile="./dist/Ohmyfish.jar" basedir="./bin">
    <manifest>
        <attribute name="Created-By" value="Bruce Yang" />
        <attribute name="Main-Class" value="org.bruce.ohmyfish.entry.Main" />
    </manifest>
    <zipgroupfileset dir="./libs" includes="**/*.jar" />
</jar>
<jar destfile="./dist/Ohmyfish.jar" basedir="./bin">
    <manifest>
        <attribute name="Created-By" value="Bruce Yang" />
        <attribute name="Main-Class" value="org.bruce.ohmyfish.entry.Main" />
    </manifest>
    <zipgroupfileset dir="./libs" includes="**/*.jar" />
</jar>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文