Versions Compared

Key

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

...

  1. We'll configure our Maven pom to create a "staging" area that will contain our izpack descriptor and all of our installer resources, including the jars that we want to package in our installer. 
    1. We will use the Maven maven-antrun-plugin to copy our izpack descriptor file and resources into this "staging" area. 
    2. We'll use the maven-dependency-plugin to copy the jar with our custom panels, and any other jar dependencies that we want in our installer. We'll configure two different "executions" of the maven-dependency-plugin; we'll have this plugin copy our application jars into one location, and the custom panel jars into a separate location.
  2. We'll then configure the izpack-maven-plugin to point it to our staging area and our installer descriptor.
Ok, let's get started.
Create

...

Some Helpful Properties
We'll be referencing the staging area location a few times in the pom, so let's configure it as a pom property to make things clearer. Let's also configure the izpack version we're using, which we'll want to reference in a few places in the pom, as well. Put this in under the root element of your pom file:
<properties>
<izpack.version>5.0.0-beta9</izpack.version>
   <izpack.staging>${project.build.directory}/staging</izpack.staging>
</properties>

...

Configure the izpack-maven-plugin

TODO

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>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>

Some key points:

TODO
</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="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.

Summary

When finished, the entire build section of our pom should look something like this:

...

                      <excludeArtifactIds>mycustompanels</excludeArtifactIds>
<excludeGroupIds>org.codehaus.izpack</excludeGroupIds>
</configuration>
</execution>
<execution>
<!-- copy izpack custom (custom panels, etc.) jars to izpack staging custom -->
<id>copy-izpack-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${izpack.staging}/custom</outputDirectory>
<excludeTransitive>false</excludeTransitive>
<stripVersion>true</stripVersion>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<includeArtifactIds>mycustompanels</includeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.izpack</groupId>
<artifactId>izpack-maven-plugin</artifactId>
<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>
</plugins>
</build>

...

Troubleshooting

TODO

References

...