Versions Compared

Key

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

...

Configure the izpack-maven-plugin

We need to tell the izpack-maven-plugin what to use as the base directory (this is our staging area), and also tell it the install file to use:

<plugin>
<groupId>org.codehaus.izpack</groupId>
<artifactId>izpack-maven-plugin</artifactId>
<version>${izpack.version}</version>
   <executions>
<execution>
<phase>package</phase>
<goals><goal>izpack</goal></goals>
<configuration>
<!-- base for relative paths in izpack descriptor -->
<baseDir>${izpack.staging}</baseDir>
<installFile>${basedir}/src/izpack/install.xml</installFile>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.izpack</groupId>
<artifactId>izpack-panel</artifactId>
<version>${izpack.version}</version>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycustompanels</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>

Some key points:

  • Even though you've already declared your custom panels dependency as a project dependency, you'll also need to declare it as a dependency to the izpack plugin itself, or else you will see classloading errors. (This is because Maven gives every plugin execution its own classloader, which cannot see the classpath of the project itself.)

Create Your Installer Descriptor

Your installer descriptor should reference resources and jars relative to the staging area. For example, here is a resources section in our installer descriptor (i.e., install.xml):

<resources>
<res src="@{izpack.staging}/common_resources/img/install-sidebar.png" id="Installer.image"/>
<res src="hello.html" id="HTMLHelloPanel.info"/>
<res src="license.html" id="HTMLLicencePanel.licence"/>
</resources>

Note that these resources are originally under src/izpack. They are copied from this directory to the staging area, where the izpack compiler will look for them.

Also, don't forget to tell the izpack compiler about your custom panels jar. In your install.xml file:

<jar src="custom/mycustompanels.jar"/>
Info
titleNote

You should see now why we use the <stripVersion>true</stripVersion> option of the maven-dependency-plugin, so that it copies the custom jar dependency without the version in its name. This way, we can reference our custom panels jar from our installer descriptor without having to know its version of it.

Here's an example of referencing a custom panel. Again, in our installer descriptor:

<panels>
<panel classname="com.mycompany.izpack.panel.MyHelloPanel"/>
</panels>

Note that we use the fully qualified name of the panel class.

...