蚂蚁耳朵更新没有完全爆炸耳(Ant Ear Update Without Full Explodin

2019-06-27 05:33发布

我使用蚂蚁1.8.2和我有一个大的EAR文件。

需要的耳朵轻微的变化,在安装过程中根据用户的选择。

在安装过程结束时,我运行Ant脚本来更新其基于用户的选择耳朵。 这些文件只包含在耳边,如果用户有相关的许可......所以更新是必要的。

目前我正在爆炸的整个耳朵,添加必要的文件,然后使更新的耳朵。

我希望能找到一种方法,我可以删除和/或添加文件,而不必经过整个解压/更新/压缩过程。

Answer 1:

耳任务有一个update属性,您可以设置为true。

这样的文件将被添加到现有的压缩文件,而不是创建一个新的。



Answer 2:

感谢您的建议@oers,下面是我用一个文件添加到耳朵和替换application.xml文件中POC。

<property name="ear.file1"  value="file1.ear"/>
<property name="ear.file2"  value="file2.ear"/>
<property name="text.file1" value="1.txt"/>
<property name="text.file2" value="2.txt"/>
<property name="xml.application1"   value="application.xml"/>
<property name="xml.application2"   value="application2.xml"/>

<target name="clean">
    <delete file="${ear.file1}"/>
    <delete file="${ear.file2}"/>
</target>

<target name="run">
    <!-- simple ear -->
    <ear earfile="${ear.file1}" appxml="${xml.application1}">
        <fileset dir="." includes="${text.file1}"/>
    </ear>  

    <!-- simple ear that will be updated -->
    <ear earfile="${ear.file2}" appxml="${xml.application1}">
        <fileset dir="." includes="${text.file1}"/>
    </ear>  
    <!-- ear update, both application.xml file and add another file. -->
    <ear earfile="${ear.file2}" appxml="${xml.application2}" update="true">
        <fileset dir="." includes="${text.file2}"/>
    </ear>  

</target>

<target name="main" depends="clean,run"/>



文章来源: Ant Ear Update Without Full Exploding Ear
标签: java ant ear