Versions Compared

Key

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

...

IzPack can be easily integrated inside an Ant build process.

You need to have the following prerequisites installed on your local system:

  • 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.

Here is how the Ant build file may look like:

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

<project defaultname="installizpack">
    <path id default="build.classpathcompile">
  
  <property   <fileset dirname="izpack-dist" value="${user.home}/IzPack"/>
  <property name="izpack-installer" value="setup.jar"/>
  
  <path  <include nameid="lib/*.jarpath" />
    <fileset    </fileset>dir="${izpack-dist}/lib" includes="*.jar"/>
    </path>
  
  <taskdef name="izpack"
classpathref="build.classpath"           classname="com.izforge.izpack.ant.IzPackTask"
           classpathref="lib.path"
           />
  
  <target name="installcompile">
    <echo message="Makes the installer using IzPack to ${izpack-installer}"/>
    <izpack input="${basedir}/src/main/resources/install.xml"
                output="IzPack-install.jar"
 ${basedir}/${izpack-installer}"  
            installerType="standard"
                inheritAll="true"  
              basedirbasedir="${basedir}/src/main/resources"
            izPackDir="${izpack-dist}"/>
   izPackDir <echo message="${user.home}/IzPack/" />
 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:
  • '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. 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'
  • izPackDir: the IzPack home directory (the target directory when executing the izpack-dist.jar)

You can find a fully compilable example here:

...