<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <parent>
    <groupId>io.hawt</groupId>
    <artifactId>project</artifactId>
    <version>1.4.47</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>hawtio-crx</artifactId>
  <packaging>crx</packaging>
  <name>${project.artifactId}</name>
  <description>hawtio :: Chrome Extension</description>

  <dependencies>
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-web</artifactId>
      <version>${project.version}</version>
      <!--
        NOTE this WAR dependency type which enables this WAR to
        inherit all the plugins and content from the core hawtio-base WAR
      -->
      <type>war</type>
    </dependency>
  </dependencies>
  <build>
    <plugins>

      <!-- use the war plugin to stage the crx files -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>
         <executions>
           <execution>
             <id>stage-crx</id>
             <phase>prepare-package</phase>
             <goals>
               <goal>exploded</goal>
             </goals>
           </execution>
         </executions>
       </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>${maven-antrun-plugin-version}</version>
        <executions>
          <execution>
            <id>crx</id>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <echo>Using crx license key: ${user.home}/.m2/hawtio-crx.pem</echo>
                <echo>Removing cruft</echo>
                <delete verbose="false" dir="${basedir}/target/${project.artifactId}-${project.version}/META-INF" />
                <delete verbose="false" dir="${basedir}/target/${project.artifactId}-${project.version}/WEB-INF" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.btmatthews.maven.plugins</groupId>
        <artifactId>crx-maven-plugin</artifactId>
        <version>1.2.0</version>
        <extensions>true</extensions>
        <configuration>
          <crxSourceDirectory>${basedir}/target/${project.artifactId}-${project.version}</crxSourceDirectory>
          <crxPEMFile>${user.home}/.m2/hawtio-crx.pem</crxPEMFile>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}/overlays</directory>
              <includes>
                <include>**/*.*</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
