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

    Copyright 2015 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-agent-parent</artifactId>
    <version>0.6.2.Final</version>
  </parent>

  <artifactId>hawkular-monitor</artifactId>

  <name>Hawkular Monitor WildFly Subsystem</name>
  <description>A WildFly subsystem that is able to collect metrics and send them to Hawkular.</description>

  <properties>
    <!-- used to replace the variables in module.xml -->
    <moduleName>org.hawkular.agent.monitor</moduleName>
    <moduleDir>org/hawkular/agent/monitor</moduleDir>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
    </dependency>

    <dependency>
      <groupId>com.squareup.okhttp</groupId>
      <artifactId>okhttp</artifactId>
    </dependency>

    <dependency>
      <groupId>com.squareup.okhttp</groupId>
      <artifactId>okhttp-ws</artifactId>
    </dependency>

    <dependency>
      <groupId>io.dropwizard.metrics</groupId>
      <artifactId>metrics-core</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hawkular.cmdgw</groupId>
      <artifactId>hawkular-command-gateway-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.hawkular.agent</groupId>
      <artifactId>hawkular-dmr-client</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- TODO: START DELETE THIS WHEN WE NO LONGER SEND TWO MESSAGES PER METRIC -->
    <!-- DON'T FORGET TO REMOVE THE DEP FROM module.xml -->
    <!-- DON'T FORGET TO REMOVE THE DEP FROM ../pom.xml DepManagement Section -->
    <dependency>
      <groupId>org.hawkular.bus</groupId>
      <artifactId>hawkular-bus-rest-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- END DELETE THIS WHEN WE NO LONGER SEND TWO MESSAGES PER METRIC -->

    <dependency>
      <groupId>org.hawkular.bus</groupId>
      <artifactId>hawkular-bus-common</artifactId>
    </dependency>

    <dependency>
      <groupId>org.hawkular.inventory</groupId>
      <artifactId>hawkular-inventory-json-helper</artifactId>
    </dependency>

    <dependency>
      <groupId>org.hawkular.metrics</groupId>
      <artifactId>clients-common</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.jgrapht</groupId>
      <artifactId>jgrapht-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.wildfly.core</groupId>
      <artifactId>wildfly-controller</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.wildfly.core</groupId>
      <artifactId>wildfly-controller-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.wildfly</groupId>
      <artifactId>wildfly-naming</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.wildfly.core</groupId>
      <artifactId>wildfly-server</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.wildfly.core</groupId>
      <artifactId>wildfly-subsystem-test</artifactId>
      <type>pom</type>
      <scope>test</scope>
    </dependency>

    <!-- these logging dependencies are only compile-time deps for generating log messages -->
    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging-annotations</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging-processor</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <excludes>
          <!-- these don't need to be in the jar, just in our module .zip -->
          <exclude>module/**</exclude>
        </excludes>
      </resource>
    </resources>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/module-assembly.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>make-module</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- USAGE: mvn -Dorg.hawkular.wildfly.home=/opt/wildfly8 wildfly-extension:deploy -->
      <plugin>
        <groupId>org.wildfly.plugins</groupId>
        <artifactId>wildfly-extension-maven-plugin</artifactId>
        <configuration>
          <moduleZip>${project.build.directory}/${project.build.finalName}-module.zip</moduleZip>
          <jbossHome>${org.hawkular.wildfly.home}</jbossHome>
          <modulesHome>modules</modulesHome>
          <serverConfig>standalone/configuration/standalone.xml</serverConfig>
          <subsystem>${project.basedir}/src/main/assembly/subsystem.xml</subsystem>
          <profiles>
            <profile>default</profile>
          </profiles>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
