<?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>1.0.2.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>1.0.2.Final</tag>
  </scm>

  <properties>
    <res.dir>sql</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.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
      <scope>provided</scope>
    </dependency>

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

    <dependency>
      <groupId>org.hawkular.commons</groupId>
      <artifactId>hawkular-inventory-paths</artifactId>
      <scope>provided</scope> <!-- there is a WildFly module -->
    </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.hawkular.inventory</groupId>
      <artifactId>hawkular-inventory-security-permissive</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>
      <exclusions>
        <exclusion>
          <groupId>org.codehaus.jettison</groupId>
          <artifactId>jettison</artifactId>  <!-- there is a WildFly module -->
        </exclusion>
      </exclusions>
    </dependency>

    <!-- By default we build with SQL backend -->
    <dependency>
      <groupId>org.hawkular.inventory</groupId>
      <artifactId>hawkular-inventory-impl-tinkerpop-sql-provider</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.umlg</groupId>
      <artifactId>sqlg-hsqldb</artifactId>
      <version>${version.org.umlg}</version>
      <exclusions>
        <exclusion>
          <groupId>org.hsqldb</groupId>
          <artifactId>hsqldb</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.tinkerpop</groupId>
          <artifactId>gremlin-groovy</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.umlg</groupId>
      <artifactId>sqlg-postgres</artifactId>
      <version>${version.org.umlg}</version>
      <exclusions>
        <exclusion>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.tinkerpop</groupId>
          <artifactId>gremlin-groovy</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Commenting this out because we're shipping with HSQLDB as our embedded solution for now.
         If you want to re-enable H2 support, don't forget to uncomment the datasource definition in the inventory
         feature-pack. -->
    <!--<dependency>-->
      <!--<groupId>org.umlg</groupId>-->
      <!--<artifactId>sqlg-h2-dialect</artifactId>-->
      <!--<version>${version.org.umlg}</version>-->
    <!--</dependency>-->

    <!-- include the versions of the drivers we want -->
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>${version.org.postgresql}</version>
    </dependency>

    <dependency>
      <groupId>org.hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <version>${version.org.hsqldb}</version>
    </dependency>

    <!-- This dependency is necessary due to exclusion of gremlin-groovy,
    since sqlg-core uses commons-lang3 which is included by transitivity
    in gremlin-groovy -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${version.commons-lang3}</version>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging</artifactId>
      <scope>provided</scope>
    </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>
  </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>titan</id>

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

      <dependencies>

        <!-- 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>
              <groupId>commons-beanutils</groupId>
              <artifactId>commons-beanutils-core</artifactId> <!-- provided by commons-beanutils since 1.9.x and there is commons-beanutils WildFly module -->
            </exclusion>
            <exclusion>
              <groupId>commons-codec</groupId>
              <artifactId>commons-codec</artifactId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <groupId>org.apache.httpcomponents</groupId> <!-- there is WildFly module org.apache.httpcomponents -->
              <artifactId>*</artifactId>
            </exclusion>
            <exclusion>
              <groupId>commons-httpclient</groupId> <!-- WildFly module org.apache.httpcomponents will hopefully serve the purpose -->
              <artifactId>*</artifactId>
            </exclusion>
            <exclusion>
              <groupId>commons-lang</groupId>
              <artifactId>commons-lang</artifactId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <groupId>log4j</groupId>
              <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
              <groupId>dom4j</groupId>
              <artifactId>dom4j</artifactId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <groupId>antlr</groupId>
              <artifactId>antlr</artifactId> <!-- a newer ANTLR is pulled by cassandra-all -->
            </exclusion>
            <exclusion>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-api</artifactId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-log4j12</artifactId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <artifactId>jsr305</artifactId>
              <groupId>com.google.code.findbugs</groupId>  <!-- a newer version is already there in inventory-rest-api -->
            </exclusion>
          </exclusions>
        </dependency>

        <dependency>
          <groupId>com.thinkaurelius.titan</groupId>
          <artifactId>titan-cassandra</artifactId>
          <version>${version.com.thinkaurelius.titan}</version>
          <scope>runtime</scope>
          <exclusions>
            <exclusion>
              <groupId>com.carrotsearch</groupId>
              <artifactId>junit-benchmarks</artifactId> <!-- hopefully not needed at runtime -->
            </exclusion>
            <exclusion>
              <groupId>com.carrotsearch.randomizedtesting</groupId>
              <artifactId>randomizedtesting-runner</artifactId> <!-- hopefully not needed at runtime -->
            </exclusion>
            <exclusion>
              <groupId>com.codahale.metrics</groupId>
              <artifactId>metrics-core</artifactId> <!-- pulled from cassandra-driver WF module -->
            </exclusion>
            <exclusion>
              <groupId>com.google.guava</groupId>
              <artifactId>guava</artifactId>  <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <artifactId>commons-codec</artifactId>
              <groupId>commons-codec</groupId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <artifactId>commons-lang</artifactId>
              <groupId>commons-lang</groupId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <groupId>io.netty</groupId>
              <artifactId>netty</artifactId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <groupId>org.apache.httpcomponents</groupId>  <!-- there is a WildFly module -->
              <artifactId>*</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.apache.cassandra</groupId>
              <artifactId>cassandra-all</artifactId> <!-- we use our own -->
            </exclusion>
            <exclusion>
              <groupId>org.codehaus.jettison</groupId>
              <artifactId>jettison</artifactId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <artifactId>slf4j-api</artifactId>
              <groupId>org.slf4j</groupId> <!-- there is a WildFly module -->
            </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>
              <groupId>com.google.guava</groupId>
              <artifactId>guava</artifactId> <!-- we use our own -->
            </exclusion>
            <exclusion>
              <groupId>org.apache.httpcomponents</groupId> <!-- there is a WildFly module -->
              <artifactId>*</artifactId>
            </exclusion>
            <exclusion>
              <artifactId>commons-cli</artifactId>
              <groupId>commons-cli</groupId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <artifactId>commons-codec</artifactId>
              <groupId>commons-codec</groupId> <!-- there is a WildFly module -->
            </exclusion>
            <exclusion>
              <artifactId>slf4j-api</artifactId>
              <groupId>org.slf4j</groupId> <!-- there is a WildFly module -->
            </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>
            <exclusion>
              <groupId>junit</groupId>
              <artifactId>junit</artifactId> <!-- hopefully not needed at runtime -->
            </exclusion>
            <exclusion>
              <artifactId>metrics-core</artifactId>
              <groupId>io.dropwizard.metrics</groupId> <!-- pulled from cassandra-driver WF module -->
            </exclusion>
            <exclusion>
              <groupId>io.netty</groupId>
              <artifactId>netty-all</artifactId> <!-- there is a WildFly module -->
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
