Installer Ant Task
As of version beta0.7.4 there is an Ant task provided to help create the installer Jars.
The task def is provided in the
lib/ant-installer-ext.jar
file.
The Task is similar to the core Ant Jar and War tasks.
To define the task use the following at the top of a
build.xml
used to create the installer.
<path id="taskdef.cp">
<fileset dir="${AntInstaller.home}">
<include name="ant-installer-ext.jar"/>
<include name="ant-installer.jar"/>
</fileset>
</path>
<taskdef
name="installer"
classname="org.tp23.antinstaller.taskdefs.Installer"
classpathref="taskdef.cp"/>
From there on in the
build.xml
file the installer task can be referenced with the
installer
element.
This example should be self explanatory, but full details are provided below for each attribute.
<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>
Description
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.
Parameters
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 |
Copyright © 2000-2004 The Apache Software Foundation. All rights
Reserved.
(lifted and altered from the WAR document)