<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2015-2017 Red Hat, Inc. and/or its affiliates
    and other contributors as indicated by the @author tags.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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.hawkular.agent</groupId>
    <artifactId>hawkular-wildfly-agent-parent</artifactId>
    <version>1.0.0.Final</version>
  </parent>

  <artifactId>hawkular-javaagent-wildfly-feature-pack</artifactId>
  <packaging>pom</packaging>

  <name>Hawkular Agent: Java Agent Feature Pack</name>
  <description>A feature pack to be able to deploy a Hawkular Java Agent in a WildFly server.</description>

  <dependencies>
    <dependency>
      <groupId>org.hawkular.agent</groupId>
      <artifactId>hawkular-javaagent</artifactId>
      <version>${project.version}</version>
      <classifier>shaded</classifier>
    </dependency>

    <!-- feature pack dependencies -->
    <dependency>
      <groupId>org.wildfly</groupId>
      <artifactId>wildfly-feature-pack</artifactId>
      <version>${version.org.wildfly}</version>
      <type>zip</type>
    </dependency>
    <dependency>
      <groupId>org.wildfly.core</groupId>
      <artifactId>wildfly-core-feature-pack</artifactId>
      <version>${version.org.wildfly.core}</version>
      <type>zip</type>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- Add the resources from src/main/resources/featurepack to feature-pack-resources working directory -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/feature-pack-resources</outputDirectory>
              <resources>
                <resource>
                  <directory>${basedir}/src/main/resources/featurepack</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.wildfly.build</groupId>
        <artifactId>wildfly-feature-pack-build-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>feature-pack-build</id>
            <phase>compile</phase>
            <goals>
              <goal>build</goal>
            </goals>
            <configuration>
              <resources-dir>target/feature-pack-resources</resources-dir>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>assemble</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>assembly.xml</descriptor>
              </descriptors>
              <appendAssemblyId>false</appendAssemblyId>
              <tarLongFileMode>gnu</tarLongFileMode>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

</project>
