An extension of the Jar task for creating installers.
This task will correctly package the AntInstaller classes, the Ant classes, the antinstall-config.xml, the build.xml file, the default LookAndFeel classes, the button icons and create the required MANIFEST.mf to execute the Jar.
Nested filesets should be used to specify other resources required by the install (e.g. License.txt) and the files required to run the application being installed.
The extended zipfileset element from the zip task (with attributes prefix, fullpath, and src) is available in the Installer task.
Attribute | Description | Required |
file | the JAR file to create. | Yes |
buildFile | The build.xml file to use when AntInstaller is run. | Yes, unless update is set to true |
installConfig | The antinstall-config.xml file to use when AntInstaller is run. | Yes, unless update is set to true |
extractType | Either NonExtractor or SelfExtractor. | Yes |
antInstallLib | The location of the AntInstaller jars. | Yes |
antLib | The location of the Ant jars. N.B. Ant 1.6.2 or above is required. | Yes |
icons | The icon set to be used. One of bluecurve, crystalsvg, amaranth, krystaline or eclipse, new icons can be created and should be packed into a Jar with the name ai-icons-[name].jar with the png files in the resources/icons directory inside the jar. | No |
validateConfig | when true the AntInstaller config file is validated and errors and warnings are printed to System.out, defaults to false | No |
failOnError | if a known error is found during validation the build will stop. | No |
basedir | the directory from which to jar the files. | No |
compress | Not only store data but also compress them, defaults to true. Unless you set the keepcompression attribute to false, this will apply to the entire archive, not only the files you've added while updating. | No |
keepcompression | For entries coming from existing archives (like nested zipfilesets or while updating the archive), keep the compression as it has been originally instead of using the compress attribute. Defaults false. | No |
encoding | The character encoding to use for filenames inside the archive. Defaults to UTF8. It is not recommended to change this value as the created archive will most likely be unreadable for Java otherwise. | No |
filesonly | Store only file entries, defaults to false | No |
includes | comma- or space-separated list of patterns of files that must be included. All files are included when omitted. | No |
includesfile | the name of a file. Each line of this file is taken to be an include pattern | No |
excludes | comma- or space-separated list of patterns of files that must be excluded. No files (except default excludes) are excluded when omitted. | No |
excludesfile | the name of a file. Each line of this file is taken to be an exclude pattern | No |
defaultexcludes | indicates whether default excludes should be used or not ("yes"/"no"). Default excludes are used when omitted. | No |
manifest | The manifest file to use if you wish to manually set the MANIFEST.MF (not recommended). | No |
update | indicates whether to update or overwrite the destination file if it already exists. Default is "false". | No |
duplicate | behavior when a duplicate file is found. Valid values are "add", "preserve", and "fail". The default value is "add". | No |
Creates a compressed self-extracting jar, validating the configuration file myprojects-antinstall-config.xml
<installer file="./MyProject-installer.jar" compress="true" extractType="SelfExtractor" installConfig="myprojects-antinstall-config.xml" buildFile="myprojects-build.xml" antInstallLib="${AntInstaller.home}/lib" antLib="${AntInstaller.home}/antlib" validateConfig="true" failOnError="true" icons="bluecurve"> <!-- include the images for your installer and license texts --> <fileset dir="extra-install-classpath" includes="resources/*"/> <!-- add you application binaries and resources to the installer here, for example --> <fileset dir="myproject" includes="myproject.jar"/> <fileset dir="myproject" includes="myproject.properties"/> <fileset dir="myproject" includes="mydefaultdata/*"/> </installer>