Developers, Developers, Developers! Maksim Sorokin IT Blog

5Jul/100

Modularized Installers with IzPack

link to dependency plugin

One may want to modularize installer's components and support them separately. It is easy to do with IzPack too!
In this example, we suppose, that installers are built with Maven.

Ok, now we assume, that we have two other installers project1-installer and project2-installer. Then we create another project for "master" installer. In "master" installer's pom.xml file we specify project1-installer and project2-installer as a dependencies:

<dependency>
  <groupId>company</groupId>
  <artifactId>project1-installer</artifactId>
  <version>version</version>
  <classifier>standard</classifier>
</dependency>

<dependency>
  <groupId>company</groupId>
  <artifactId>project2-installer</artifactId>
  <version>version</version>
  <classifier>standard</classifier>
</dependency>

Then we use a dependency plugin to dump project1-installer and project2-installer. And then in install.xml in the "master" installer in the pack section we specify, that we want to include those dependencies in our "master" installation:

<packs>
  <pack name="main" required="yes">
    <description>Master Installation</description>

    <file src="${dependencies.dir}/project1-installer-standard.jar" targetdir="$INSTALL_PATH/install" override="true" />
    <file src="${dependencies.dir}/project2-installer-standard.jar" targetdir="$INSTALL_PATH/install" override="true" />
  </pack>
</packs>

All we left to do is just to call these project1-installer and project2-installer in order. So we create a ProcessPanel and in configuration file of that panel we specify, that we want to run a bat file:

<processing>
  <job name="Install">
    <executefile name="$INSTALL_PATH/install/dependenciesInstall.bat" />
  </job>
</processing>

Where the dependenciesInstall.bat would be the following:

echo off

echo.
echo -------------------------------------------------------
echo Launching Project1 Installer
"${INSTALL_PATH}\install\project1-installer-standard.jar

echo.
echo -------------------------------------------------------
echo Launching Project1 Installer
"${INSTALL_PATH}\install\project2-installer-standard.jar

echo.
echo -------------------------------------------------------
echo Done

And of course we need to include that dependenciesInstall.bat into our installer by specifying in pack section of install.xml:

<parsable targetfile="$INSTALL_PATH/install/dependenciesInstall.bat" />
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


Trackbacks are disabled.