我有一个 izpack 安装程序,其中包含我的项目和一个媒体文件夹(500 MB)。当我启动安装程序时,我必须等待几秒钟,因为它会解压所有文件。
我的问题是:我可以选择包外的文件(媒体文件夹)将其复制到安装路径吗?
通过谷歌,我只找到了本页底部的解决方案:https://groups.google.com/forum/#!topic/izpack-user/mjA6AXzSouw
最佳答案
您可以运行 ANT 目标来复制此媒体文件(大概是从包含 installer.jar
的同一个 .zip 文件中提取的,尽管这取决于您)。
install.xml:
<listeners> <listener classname="AntActionInstallerListener" stage="install" /> <listener classname="AntActionUninstallerListener" stage="uninstall" /> </listeners>
UserInputSpec.xml:
<field type="file" align="left" variable=
<强>"the.file"
> <spec txt="" size="25" set=""/> </field>
UserInputPanel:
要求用户通过File Chooser
找到并选择媒体文件。 field 。文件位置将保存在the.file
中变量,如上所示。AntActionsSpec.xml:
<antcall buildfile=
<强>"location of ANT_XML_FILE"
order="afterpacks"> <target name=
<强>"copyFile"
></target> <property name=
<强>"dest.dir"
value=
<强>"$INSTALL_PATH"
></property> <property name=
<强>"the_file"
value=
<强>"${the.file}"
></property> </antcall>
ANT_XML_FILE:
<target name=
<强>"copyFile"
> <copy todir=
<强>"${dest.dir}"
file=
<强>"${the_file}"
/> </target>
关于java - IZPack 将外部文件复制到安装路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21674778/