Listeners

Listeners

An IzPack listener is a Java class that can add to, or modify, IzPack functionality at various points during install, uninstall, or compile.

Using Listeners

Listeners are embedded into an installer using the <listeners> element. Any number of <listener> tags can be included for any of the three IzPack lifecycle stages.

Example
<listeners>
  <listener classname="AntActionInstallerListener" stage="install"/>
  <listener classname="ConfigurationInstallerListener" stage="install"/>
</listeners>

The <listener> element has the following attributes:

Attribute NameDescriptionRequired
classnameSpecifies the name of the class implementing the required listener. May be a bare class name (usually used for built-in listeners, e.g. AntActionInstallerListener) or a fully-qualified class name.Yes
stage

The lifecycle stage in which the listener should be registered. Valid values are:

  • install
  • uninstall
  • compile 
Yes
jarFor custom listeners, specifies the containing JAR file. Must be an absolute path, or relative to IZPACK_HOME.No, unless the specified class is not a built-in IzPack listener

A listener might require that additional JAR files or resources be added to the installation descriptor. See the documentation of the specific listener you intend to use. For example, the AntActionInstallerListener expects at least several jar files from Apache Ant (or more, in case of using non-standard Ant tasks), and an Ant buildfile as resource.