问题描述
限时送ChatGPT账号..我目前正在这样做:
<jar update="yes"
jarfile="${pwd}/dist/${release}_installer.jar">
<zipfileset src="${pwd}/dist/app.jar" includes="com/izforge/izpack/panels/**"/>
<zipfileset src="${pwd}/dist/app.jar" includes="com/xyz/img/logo.png"/>
</jar>
我现有的安装程序 JAR 得到更新,以根据需要包含从应用 JAR 中提取的文件.
My existing installer JAR gets updated to include the files as needed, extracted from the app JAR.
到目前为止,一切都很好.
So far, so good.
但是,我想修改行为,使图像文件的路径与从中复制的路径不同:
However, I want to modify the behaviour such that the path of the image file is different than what is being copied from:
目前:
com/izforge/izpack/panels/MyIzPanel.class
com/xyz/img/logo.png
我想要的:
com/izforge/izpack/panels/MyIzPanel.class
blah/img/logo.png
所以我需要复制文件,但使用
和
这样我就可以修改目录结构了.
So I need to copy the files, but use <zipfileset>
and <jar>
in such a way that I can modify the directory structure.
有没有办法做到这一点,除了解压缩整个内容复制文件然后再次压缩它?
Is there a way to do this, apart from unzipping the entire contents copying file and then zipping it back up again?
链接到较早的相关问题:ant task to remove files from a罐子
Link to earlier related question: ant task to remove files from a jar
推荐答案
您可以使用 fullpath
属性:
<zipfileset src="${pwd}/dist/app.jar"
includes="com/xyz/img/logo.png" fullpath="blah/img/logo.img"/>
如果您需要复制多个文件,您可能需要查看 prefix
属性,例如:
If you need to copy several files you may want to have a look at the prefix
attribute, e.g.:
<zipfileset src="${pwd}/dist/app.jar"
includes="**/*.png" prefix="blah/img"/>
这篇关于ant : jar 和 zipfileset - 将文件从一个 JAR 复制到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论