<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.openpreservation.jhove</groupId>
    <artifactId>jhove</artifactId>
    <version>1.28.0</version>
  </parent>

  <artifactId>jhove-installer</artifactId>
  <name>JHOVE Installer</name>
  <description>Maven-built IzPack installer for JHOVE.</description>

  <properties>
    <installer.output.filename>jhove-xplt-installer-${project.version}.jar</installer.output.filename>
    <izpack.version>5.1.3</izpack.version>
    <izpack.staging>${project.build.directory}/staging</izpack.staging>
    <izpack.target>${project.build.directory}</izpack.target>
    <izpack.scripts>${project.build.scriptSourceDirectory}</izpack.scripts>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>izpack-staging</id>
            <!-- Here the phase you need -->
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${izpack.staging}</outputDirectory>

              <!--
              Recursive copy of all resource under src/main/izpack.
              This is the stuff to install, as well as install.xml
              and panel data and such.
              -->
              <resources>
                <resource>
                  <directory>src/main/izpack</directory>
                  <filtering>true</filtering>
                  <includes>
                    <include>install.xml</include>
                  </includes>
                </resource>
                <resource>
                  <directory>src/main/izpack</directory>
                  <filtering>false</filtering>
                  <excludes>
                    <exclude>install.xml</exclude>
                  </excludes>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>jhove-resources</id>
            <!-- Here the phase you need -->
            <phase>validate</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${izpack.staging}</outputDirectory>

              <!--
              Recursive copy of all resource under src/main/izpack.
              This is the stuff to install, as well as install.xml
              and panel data and such.
              -->
              <resources>
                <resource>
                  <directory>src/main/</directory>
                  <filtering>false</filtering>
                  <excludes>
                    <exclude>izpack</exclude>
                  </excludes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <!-- Copy IzPack custom JARS (custom panels, etc.) to IzPack staging custom -->
            <id>copy-izpack-dependencies</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${izpack.staging}/bin</outputDirectory>
              <excludeTransitive>false</excludeTransitive>
              <stripVersion>false</stripVersion>
              <overWriteReleases>true</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
        </executions>
      </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>
        <configuration>
          <descriptorEncoding>UTF-8</descriptorEncoding>
          <finalName>jhove-izpack-installer</finalName>
          <classifier>${project.version}</classifier>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>izpack</goal>
            </goals>
            <configuration>
              <!-- Base for relative paths in IzPack descriptor -->
              <baseDir>${izpack.staging}</baseDir>
              <installFile>${izpack.staging}/install.xml</installFile>
              <output>${project.build.directory}/${installer.output.filename}</output>
            </configuration>
          </execution>
        </executions>
        <!--
        Must have a dependency here on any code used in the installer,
        otherwise the classloader will not find it. So in this case we need our panels
        and then the package that contains the base classes for the panels.
        -->
        <dependencies>
          <dependency>
            <groupId>org.codehaus.izpack</groupId>
            <artifactId>izpack-panel</artifactId>
            <version>${izpack.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.openpreservation.jhove</groupId>
      <artifactId>jhove-apps</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove</groupId>
      <artifactId>jhove-ext-modules</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>aiff-hul</artifactId>
      <version>1.6.2</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>ascii-hul</artifactId>
      <version>1.4.2</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>gif-hul</artifactId>
      <version>1.4.3</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>html-hul</artifactId>
      <version>1.4.3</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>jpeg2000-hul</artifactId>
      <version>1.4.4</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>jpeg-hul</artifactId>
      <version>1.5.4</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>pdf-hul</artifactId>
      <version>1.12.4</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>tiff-hul</artifactId>
      <version>1.9.4</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>utf8-hul</artifactId>
      <version>1.7.3</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>wave-hul</artifactId>
      <version>1.8.2</version>
    </dependency>
    <dependency>
      <groupId>org.openpreservation.jhove.modules</groupId>
      <artifactId>xml-hul</artifactId>
      <version>1.5.3</version>
    </dependency>
  </dependencies>

</project>
