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

    Copyright 2015-2016 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>
    <artifactId>hawkular-inventory-parent</artifactId>
    <groupId>org.hawkular.inventory</groupId>
    <version>0.14.0.Final</version>
  </parent>

  <artifactId>hawkular-inventory-dist</artifactId>
  <packaging>war</packaging>

  <name>Hawkular Inventory REST War Distribution</name>
  <description>
    Overlays the rest servlet with bus and sets up the dependencies and default configuration to make it ready for
    inclusion in Hawkular.
  </description>

  <scm>
    <url>https://github.com/hawkular/hawkular-inventory</url>
    <connection>scm:git:https://github.com/hawkular/hawkular-inventory</connection>
    <developerConnection>scm:git:git@github.com:hawkular/hawkular-inventory.git</developerConnection>
    <tag>0.14.0.Final</tag>
  </scm>

  <properties>
    <res.dir>titan</res.dir>
  </properties>

  <dependencies>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.mail</groupId>
      <artifactId>javax.mail-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.hawkular.inventory</groupId>
      <artifactId>hawkular-inventory-cdi</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.hawkular.inventory</groupId>
      <artifactId>hawkular-inventory-bus</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.jboss.spec.javax.jms</groupId>
      <artifactId>jboss-jms-api_2.0_spec</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.hawkular.inventory</groupId>
      <artifactId>hawkular-inventory-rest-api</artifactId>
      <version>${project.version}</version>
      <type>war</type>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.hawkular.inventory</groupId>
      <artifactId>hawkular-inventory-impl-tinkerpop</artifactId>
      <version>${project.version}</version>
      <scope>runtime</scope>
    </dependency>

    <!-- TODO HACK ALERT: We're coupling pinger here... -->
    <!-- This is being used by Pinger which also depends on us. Going forward should work shouldn't it? ;) -->
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>${version.org.apache.httpcomponents}</version>
      <exclusions>
        <exclusion>
          <artifactId>commons-codec</artifactId>
          <groupId>commons-codec</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging</artifactId>
    </dependency>

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

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

    <dependency>
      <groupId>org.jboss.spec.javax.ejb</groupId>
      <artifactId>jboss-ejb-api_3.2_spec</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- Titan dependency mess -->
    <dependency>
      <groupId>org.hawkular.inventory</groupId>
      <artifactId>hawkular-inventory-impl-tinkerpop-titan-provider</artifactId>
      <version>${project.version}</version>
      <scope>runtime</scope>
      <exclusions>
        <exclusion>
          <artifactId>commons-codec</artifactId>
          <groupId>commons-codec</groupId>
        </exclusion>
        <exclusion>
          <artifactId>slf4j-api</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>slf4j-log4j12</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>commons-lang</artifactId>
          <groupId>commons-lang</groupId>
        </exclusion>
        <exclusion>
          <artifactId>log4j</artifactId>
          <groupId>log4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>commons-beanutils-core</artifactId>
          <groupId>commons-beanutils</groupId><!-- provided by commons-beanutils since 1.9.x -->
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.thinkaurelius.titan</groupId>
      <artifactId>titan-cassandra</artifactId>
      <version>${version.com.thinkaurelius.titan}</version>
      <scope>runtime</scope>
      <exclusions>
        <exclusion>
          <!-- We get a newer version from Cassandra -->
          <groupId>org.jboss.netty</groupId>
          <artifactId>netty</artifactId>
        </exclusion>
        <exclusion>
          <!-- we use our own -->
          <groupId>org.apache.cassandra</groupId>
          <artifactId>cassandra-all</artifactId>
        </exclusion>
        <exclusion>
          <!-- we use our own -->
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
        <exclusion>
          <!-- TODO HACK ALERT: We're coupling pinger here... -->
          <!-- We need to depend on another version that is also used in Pinger. This should disappear once pinger
          becomes a proper remote client of inventory. -->
          <groupId>org.apache.httpcomponents</groupId>
          <artifactId>httpclient</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>commons-codec</artifactId>
          <groupId>commons-codec</groupId>
        </exclusion>
        <exclusion>
          <artifactId>slf4j-api</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>commons-lang</artifactId>
          <groupId>commons-lang</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <scope>provided</scope><!-- there is a WF module -->
    </dependency>

    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <scope>provided</scope><!-- there is a WF module -->
    </dependency>

    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <scope>provided</scope><!-- there is a WF module -->
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>provided</scope><!-- there is a WF module -->
    </dependency>

    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <scope>provided</scope><!-- there is a WF module -->
    </dependency>

    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <scope>provided</scope><!-- there is a WF module -->
    </dependency>

    <dependency>
      <groupId>commons-pool</groupId>
      <artifactId>commons-pool</artifactId>
      <scope>provided</scope><!-- there is a WF module -->
    </dependency>

    <dependency>
      <groupId>org.apache.cassandra</groupId>
      <artifactId>cassandra-all</artifactId>
      <exclusions>
        <exclusion>
          <!-- we use our own -->
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>

        <exclusion>
          <groupId>org.antlr</groupId>
          <artifactId>antlr</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.antlr</groupId>
          <artifactId>antlr-runtime</artifactId>
        </exclusion>

        <!-- loaded via WF module -->
        <exclusion>
          <artifactId>commons-cli</artifactId>
          <groupId>commons-cli</groupId>
        </exclusion>

        <!-- loaded via WF module -->
        <exclusion>
          <artifactId>commons-codec</artifactId>
          <groupId>commons-codec</groupId>
        </exclusion>
        <exclusion>
          <artifactId>slf4j-api</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>log4j-over-slf4j</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jcl-over-slf4j</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>commons-lang3</artifactId>
          <groupId>org.apache.commons</groupId>
        </exclusion>
        <exclusion>
          <artifactId>logback-core</artifactId>
          <groupId>ch.qos.logback</groupId>
        </exclusion>
        <exclusion>
          <artifactId>logback-classic</artifactId>
          <groupId>ch.qos.logback</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>${project.build.sourceDirectory}/../resources/${res.dir}</directory>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <overlays>
            <overlay>
              <groupId>org.hawkular.inventory</groupId>
              <artifactId>hawkular-inventory-rest-api</artifactId>
            </overlay>
            <overlay>
              <!-- empty groupId/artifactId represents the current build -->
            </overlay>
          </overlays>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.revapi</groupId>
        <artifactId>revapi-maven-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>sql</id>
      <properties>
        <res.dir>sql</res.dir>
      </properties>

      <dependencies>
        <!--
        NOTE THAT THE SQL PROVIDER BUNDLED BY DEFAULT (AND SHOULD NOT BE OUTSIDE OF DEV TESTING). IN ADDITION
        TO BUILDING THIS MODULE WITH WITH -Psql, YOU HAVE TO MODIFY THE hawkular-inventory-feature-pack TO
        INCLUDE THE DATASOURCE DEFINITION (OR DEFINE IT YOURSELF) AND PASS SOME SYSTEM PROPS TO HAWKULAR SERVER
        STARTUP. SEE
        hawkular-inventory-feature-pack/src/main/resources/subsystem-templates/hawkular-inventory-datasources.xsl
        FILE FOR MORE DETAILS. -->
        <dependency>
          <groupId>org.hawkular.inventory</groupId>
          <artifactId>hawkular-inventory-impl-tinkerpop-sql-provider</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
