8

I have a working IzPack installer project set up with maven and added following to my install script install.xml to [installation][listeners]:

<listener classname="(company-name).listener.InstallerListener" stage="install"/>


Sadly, the line seems to be ignored and the debugger does not halt on set breakpoints in the InstallListener class. I have read the documentation for InstallListeners, but it is not useful as I have the build process integrated with maven; here are the relevant parts of the Project Object Model pom.xml:

<properties>
    <izpack-standalone.version>4.3.1</izpack-standalone.version>
</properties>

<dependencies>
    <!-- izpack -->
    <dependency>
        <groupId>org.codehaus.izpack</groupId>
        <artifactId>izpack-standalone-compiler</artifactId>
        <version>${izpack-standalone.version}</version>
        <optional>true</optional>
    </dependency>
</dependencies>

<plugins>    
    <!--  IzPack compiler  -->
    <plugin>
        <groupId>org.codehaus.izpack</groupId>
        <artifactId>izpack-maven-plugin</artifactId>
        <version>${org.codehaus.izpack.izpack-maven-plugin.version}</version>
        <dependencies>
            <dependency>
                <groupId>org.codehaus.izpack</groupId>
                <artifactId>izpack-standalone-compiler</artifactId>
                <version>${izpack-standalone.version}</version>
            </dependency>
        </dependencies>
        <configuration>
            <izpackBasedir>${staging.dir}</izpackBasedir>
            <customPanelDirectory>${staging.dir}</customPanelDirectory>
        </configuration>
        <executions>
            <execution>
                <id>standard-installer</id>
                <phase>package</phase>
                <goals>
                    <goal>izpack</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>

What am I missing here?


Note: The compiled installer does contain the specified InstallerListener class file, so it is available at runtime.

Binkan Salaryman
  • 3,008
  • 1
  • 17
  • 29
  • The izpack-maven-plugin states for the customPanelDirectory: Location of external custom panel's jars which must be placed under sub directory bin/panels. ( ie ${customPanelDirectory/bin/panels ). Does that match your setup and the location of our InstallListener class file in the installer? – Torsten May 18 '15 at 20:49
  • I build the panels along with the install script and wrap it all up to a jar with ant / maven-dependency-plugin. – Binkan Salaryman May 20 '15 at 08:18
  • So far so good. But is this jar file located in {customPanelDirectory}/bin/panels when creating the installer? – Torsten May 20 '15 at 12:22
  • 1
    Our code is included to the target installer jar with ```` (**install.xml**) – Binkan Salaryman May 21 '15 at 07:33

1 Answers1

1

You must place the jar file containing your panel classes into the {customPanelDirectory}/bin/panels folder where it will be picked up automatically by the izpack-maven-plugin.

In the case above this folder would resolve to {staging.dir}/bin/panels since you configured <customPanelDirectory>${staging.dir}</customPanelDirectory>.

Adding it to install.xml file will not work, since this would be resolved at install time, but not at installer build time.

Torsten
  • 6,184
  • 1
  • 34
  • 31
  • Where is ``${customPanelDirectory}``? And are you sure that all the code should be treated as a "panel"? Because it isn't just a panel. It has business logic and a bunch of panel classes. – Binkan Salaryman May 21 '15 at 12:29
  • ${customPanelDirectory} is what you defined in your plugin configuration: `${staging.dir}`. There you should place the jar containing all the needed classes. – Torsten May 21 '15 at 13:59
  • When I changed the compilation target of our code to ``{staging.dir}/bin/panels`` (**pom.xml**) and removed ```` (**install.xml**), the izpack compiler did *not* pick the "panel jar file" up. We found workarounds which makes the usage of a ``InstallerListener`` unnecessary. Nevertheless, I am still interested to know why it does not work. – Binkan Salaryman May 22 '15 at 11:00
  • It might be necessary to have the jar file here and not just the compiled classes, other than that I am out of ideas. – Torsten May 22 '15 at 14:31