<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements.  See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership.  The ASF licenses this file
~ to you 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>atlas-graphdb</artifactId>
        <groupId>org.apache.atlas</groupId>
        <version>0.9-incubating-SNAPSHOT</version>
    </parent>
    <artifactId>atlas-graphdb-titan1</artifactId>
    <description>Apache Atlas Titan 1.0.0 Graph DB Impl</description>
    <name>Apache Atlas Titan 1.0.0 GraphDB Impl</name>
    <packaging>jar</packaging>

    <properties>
        <tinkerpop.version>3.0.1-incubating</tinkerpop.version>
        <titan.version>1.0.0</titan.version>
        <checkstyle.failOnViolation>false</checkstyle.failOnViolation>
    </properties>
    <profiles>
        <profile>
            <id>titan1</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>1.4.1</version>
                        <executions>
                            <execution>
                                <id>enforce-java-8</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireJavaVersion>
                                            <version>1.8.0</version>
                                        </requireJavaVersion>
                                        <requireMavenVersion>
                                            <version>3.1.0</version>
                                        </requireMavenVersion>
                                    </rules>
                                    </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.18.1</version>
                        <configuration>
                            <skip>${skipUTs}</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                       <artifactId>maven-compiler-plugin</artifactId>
                       <version>3.1</version>
                        <configuration>
                            <skipMain>false</skipMain>
                            <skip>false</skip>
                            <excludes>
                                <exclude>org.apache.atlas</exclude>
                             </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <graphdb.backend.impl>org.apache.atlas.repository.graphdb.titan1.Titan1GraphDatabase</graphdb.backend.impl>
            </properties>
        </profile>
    </profiles>
    <dependencies>
        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-graphdb-common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-graphdb-api</artifactId>
            <!-- set scope to provided to prevent the this from being included in the shared jar -->
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.thinkaurelius.titan/titan-hbase -->
        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-hbase</artifactId>
            <version>${titan.version}</version>
        </dependency>

        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-core</artifactId>
            <version>${titan.version}</version>
        </dependency>

        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-solr</artifactId>
            <version>${titan.version}</version>
            <!-- this conflicts with the servlet api version that Atlas needs -->
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-client</artifactId>
        </dependency>

        <dependency>
            <groupId>com.vividsolutions</groupId>
            <artifactId>jts</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-solrj</artifactId>
        </dependency>

        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-es</artifactId>
            <version>${titan.version}</version>
        </dependency>

        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-berkeleyje</artifactId>
            <version>${titan.version}</version>
        </dependency>

        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-lucene</artifactId>
            <version>${titan.version}</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
        </dependency>

        <!-- titan 1 requires guava 18.0 -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>

        <!-- Graph DB -->
        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>gremlin-core</artifactId>
            <version>3.0.1-incubating</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>tinkergraph-gremlin</artifactId>
            <version>3.0.1-incubating</version>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-graphdb-common</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!--  Skip the compilation of code and tests by default. Titan 1 code will be compiled only when titan1 profile is explicitly enabled. -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <skipMain>true</skipMain>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <skip>true</skip>
                    <skipTests>true</skipTests>
                </configuration>
             </plugin>
            <!--
                 Create 'uber' jar that contains all of the dependencies (except those whose scope is provided)
                 Only titan 1 and its dependencies are included.  The other dependencies are bundled in the war file.

We also relocate the Google guava packages to avoid conflicts with Atlas code which depends on Guava 14
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>false</shadedArtifactAttached>
                            <artifactSet>
                                <excludes>
                                    <!-- these are bundled with Atlas -->
                                    <exclude>org.slf4j:*</exclude>
                                </excludes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <pattern>com.google.common</pattern>
                                    <shadedPattern>org.apache.atlas.shaded.com.google.common</shadedPattern>
                                </relocation>
                            </relocations>
                            <!-- disable generation of sources jar due to clash with maven-source-plugin -->
                            <!-- <createSourcesJar>true</createSourcesJar> -->
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.thinkaurelius.titan</groupId>
                <artifactId>titan-core</artifactId>
                <version>1.0.0</version>
                <exclusions>
                    <!-- rexster does not work with servlet-api -->
                    <exclusion>
                        <groupId>com.tinkerpop.rexster</groupId>
                        <artifactId>rexster-core</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.tinkerpop.rexster</groupId>
                        <artifactId>rexster-server</artifactId>
                    </exclusion>
                    <!-- asm 4.0 does not work with jersey asm 3.1 -->
                    <exclusion>
                        <groupId>com.tinkerpop</groupId>
                        <artifactId>frames</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.esotericsoftware.reflectasm</groupId>
                        <artifactId>reflectasm</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm</artifactId>
                    </exclusion>
                    <exclusion> <!-- GPL license imported from ganglia -->
                        <groupId>org.acplt</groupId>
                        <artifactId>oncrpc</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>com.thinkaurelius.titan</groupId>
                <artifactId>titan-berkeleyje</artifactId>
                <version>1.0.0</version>
            </dependency>

            <dependency>
                <groupId>com.thinkaurelius.titan</groupId>
                <artifactId>titan-hbase</artifactId>
                <version>1.0.0</version>
            </dependency>

            <dependency>
                <groupId>com.thinkaurelius.titan</groupId>
                <artifactId>titan-solr</artifactId>
                <version>1.0.0</version>
            </dependency>
        </dependencies>

    </dependencyManagement>
</project>
