Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • a Java runtime environment (Oracle, OpenJDK etc.), version 6 or above,
    Apache Ant will probably require the $JAVA_HOME environment variable to be set to it.
  • a preinstalled version of the Apache Ant runtime (version 1.6.5 or above),
  • the latest distribution installer of IzPack 5.


The IzPack task takes the following parameters as attributes:
  • input: the XML installation file. The installation can be specified as an external file, or embedded using a config child element.
  • output: the output jar installer file
  • installerType: (optional), possible values: standard or web. If web, the <webdir> attribute must be specified in the input file. Used to force creation of a standard installer when the <webdir> attribute has been used.
  • inheritAll: (optional, boolean). If true all properties defined in the ant build process are transmitted to izpack parser for substitution. 

  • baseDir: the base directory to resolve the relative paths
  • izPackDir: the IzPack home directory (the target directory when executing the izpack-dist.jar)
  • mkdirs: whether to automatically create the parent directories of the installer jar to be built.
  • inheritAll: If true, pass all Ant properties to IzPack. Defaults to false.
  • compression: The type of compression to set for pack compression.
  • compressionLevel: The compression level if compression is set to true.

Nested elements:

  • <config>
    Used for embedding the contents of install.xml as CDATA directly to the build file (see the example below) 
  • <property>
    Add a property to the build visible only to the IzPack task. The Syntax is the same like for defining properties in Ant. 

Here is how the Ant build file may look like:

...


Code Block
languagexml
titleExample
<?xml version="1.0" encoding="UTF-8"?>

<project name="izpack" default="compile">
  
  <property name="izpack-dist" value="${user.home}/IzPack"/>
  <property name="izpack-installer" value="setup.jar"/>
  
  <path id="lib.path">
    <fileset dir="${izpack-dist}/lib" includes="*.jar"/>
  </path>
  
  <taskdef name="izpack"
           classname="com.izforge.izpack.ant.IzPackTask"
           classpathref="lib.path"
           />
  
  <target name="compile">
    <echo message="Makes the installer using IzPack to ${izpack-installer}"/>
    <izpack input="${basedir}/src/main/resources/install.xml"
            output="${basedir}/${izpack-installer}"  
            installerType="standard"              
            basedir="${basedir}/src/main/resources"
            izPackDir="${izpack-dist}"/>
    <echo message="${izpack-installer} created"/>
  </target>
  
</project>

The above assumes that the IzPack distribution has been installed to ${user.home}/IzPack.

The IzPack task takes the following parameters:

...

inheritAll: optional, boolean. If true all properties defined in the ant build process are transmitted to izpack parser for substitution. 

...

IzPack

...

.

You can find a fully compilable example here:

View file
nametest.zip
height250

...

It builds an executable installer setup.jar in the working directory.

Anchor
Example of embedding install.xml as CDATA
Example of embedding install.xml as CDATA
Embedding the installation file using a

...

<config> element

Instead of using the 'input' attribute to specify an external installation document, you can embed the installation config as a child of the IzPack task using a config child element with a CDATA section. For example:

...