蚂蚁:罐子和zipfileset - 从一个JAR文件复制到另一个 [英] ant : jar and zipfileset - copy files from one JAR into another
问题描述
我目前这样做:
<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
所以,我需要复制的文件,但使用 &LT; zipfileset&GT;
和 &LT ;罐子方式&gt;
以这样的方式,我可以修改的目录结构
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任务从删除文件罐子
Link to earlier related question: ant task to remove files from a jar
推荐答案
您可以使用完整路径
属性:
<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"/>
这篇关于蚂蚁:罐子和zipfileset - 从一个JAR文件复制到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!