【问题标题】:Overwrite files with condiction Izpack使用条件 Izpack 覆盖文件
【发布时间】:2014-06-16 16:40:05
【问题描述】:

我有一个将一些文件放入客户端计算机的安装程序,所以我希望相同的安装程序成为更新安装程序,所以我想设置一个条件,如果这些文件已经存在,我将向用户显示一个对话框,选择是否他想替换或不替换文件。

我的izpack代码是这样的

<pack name="Product" required="yes">
            <file src="../@{project.artifactId}.jar" targetdir="$INSTALL_PATH" />
            <fileset dir="../resources" targetdir="$INSTALL_PATH/resources">
                <include name="**/*" />
            </fileset>

            <fileset dir="dependency" targetdir="$INSTALL_PATH/lib">
                <include name="**/*" />
            </fileset>

            <fileset dir="../resources/icons" targetdir="$INSTALL_PATH">
                <include name="favicon.ico" />
            </fileset>

</pack>

【问题讨论】:

    标签: java installation izpack


    【解决方案1】:

    我已经使用属性 override 解决了这个问题,其值为 asktrue,如下面的代码所示

    您也可以使用标记排除源目录中的某些文件

    <file src="../resources/myfile.properties" targetdir="$INSTALL_PATH/resources" override="asktrue" />
    <fileset dir="../resources" targetdir="$INSTALL_PATH/resources">
      <exclude name="**/myfile.properties" />
      <include name="**/*" />
    </fileset>
    

    【讨论】:

    • 你在哪里 put a condition if these files already existsshow a dialog to the user choose if he wants to replace or not the files&lt;exclude&gt; 没有做太多的事情来满足要求。
    • 在属性覆盖中,您可以将值“asktrue”放在此处是文档docs.codehaus.org/display/IZPACK/Pack+FileSet
    • 好的。而且,你的solved the problem using the following code 不应该包含override="asktrue"
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-21
    • 2014-04-08
    • 2016-11-05
    • 1970-01-01
    • 2020-12-29
    • 2013-01-27
    相关资源
    最近更新 更多