Versions Compared

Key

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

...

We'll use the maven-antrun-plugin to copy our installer descriptor and installer resources (images, text files, etc.) into our "staging" area.

I put my Put your installer descriptor and resources into underneath src/izpack in my your module.

 

Configure the maven-dependency-plugin

TODO

...

In your pom's <build> section, configure maven-antrun-plugin to copy this entire directory to our staging area:

   <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>create-staging-area</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${izpack.staging}">
<fileset dir="${basedir}/src/izpack"/>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
Configure the maven-dependency-plugin

We'll configure the maven-depenency-plugin to copy both our application jars and the jar with our custom panel. Here's how it looks (see the inline XML comments for more details):

   <plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<!-- copy *application* jars to izpack staging lib -->
<id>copy-product-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${izpack.staging}/lib</outputDirectory>
<excludeTransitive>false</excludeTransitive>
<stripVersion>true</stripVersion>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeScope>system</excludeScope> <!-- this excludes tools.jar, e.g. -->
<excludeArtifactIds>mycustompanels</excludeArtifactIds> <!-- IMPORTANT: don't copy custom panels where our application jars live -->
                      <excludeGroupIds>org.codehaus.izpack</excludeGroupIds> <!-- IMPORTANT: we don't want to copy the izpack dependency where our application jars live -->
</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> <!-- IMPORTANT: this causes *only* our custom panels to be copied -->
</configuration>
</execution>
</executions>
</plugin>

Some key points:

  • The first execution section configures copying our application jars to the lib/ directory under our staging directory (i.e., target/staging/lib). Note that we have to explicitly exclude the izpack dependency as well as our custom panels dependency. We don't need these showing up in our installed application!
  • The second execution section configures copying our custom panels jar to the custom/ directory under our staging directory (i.e., target/staging/custom). Note that we explicitly include our custom panels dependency so that no other jars are copied to custom/. It wouldn't hurt anything if this happened, but why do unnecessary work?
The maven-dependency-plugin is very configurable. You may need to customize some of this configuration for your own purposes.
Configure the izpack-maven-plugin

TODO

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

Some key points:

  • TODO

Summary

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

<build>
<plugins>
<!-- copy izpack resources into izpack staging area, expected by izpack.xml -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>create-staging-area</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${izpack.staging}">
<fileset dir="${basedir}/src/izpack"/>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<!-- copy product jars to izpack staging lib -->
<id>copy-product-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${izpack.staging}/lib</outputDirectory>
<excludeTransitive>false</excludeTransitive>
<stripVersion>true</stripVersion>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeScope>system</excludeScope> <!-- this excludes tools.jar, <overWriteIfNewer>true</overWriteIfNewer>e.g. --> 
                      <excludeScope>system</excludeScope> <!-- tools.jar --><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>heatlamp-assembly-izpack-base<<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>presspass<groupId>com.heatlamp<mycompany</groupId>
<artifactId>heatlamp-assembly-izpack-base<<artifactId>mycustompanels</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

 

Troubleshooting

TODO

References

[1] http://izpack.codehaus.org/izpack-maven-plugin/

...