<?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>apache-atlas</artifactId>
        <groupId>org.apache.atlas</groupId>
        <version>0.9-incubating-SNAPSHOT</version>
        <relativePath>../../</relativePath>
    </parent>
    <artifactId>storm-bridge</artifactId>
    <description>Apache Atlas Storm Bridge Module</description>
    <name>Apache Atlas Storm Bridge</name>
    <packaging>jar</packaging>

    <properties>
        <storm.version>1.0.0</storm.version>
        <hive.version>1.2.1</hive.version>
    </properties>

    <dependencies>
        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

        <!-- apache atlas core dependencies -->
        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-typesystem</artifactId>
        </dependency>

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

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-notification</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>hdfs-model</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>hive-bridge</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-exec</artifactId>
            <version>${hive.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-common</artifactId>
            <version>${hbase.version}</version>
        </dependency>

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

        <!-- apache storm core dependencies -->
        <dependency>
            <groupId>org.apache.storm</groupId>
            <artifactId>storm-core</artifactId>
            <version>${storm.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Testing dependencies -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </dependency>

        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- to bring up atlas server for integration tests -->

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-graphdb-impls</artifactId>
            <type>pom</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-webapp</artifactId>
            <type>war</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-typesystem</artifactId>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>dist</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-hook</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/dependency/hook/storm/atlas-storm-plugin-impl</outputDirectory>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>false</overWriteSnapshots>
                                    <overWriteIfNewer>true</overWriteIfNewer>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>${project.artifactId}</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.json4s</groupId>
                                            <artifactId>json4s-native_${scala.binary.version}</artifactId>
                                            <version>${json.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.json4s</groupId>
                                            <artifactId>json4s-core_${scala.binary.version}</artifactId>
                                            <version>${json.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.json4s</groupId>
                                            <artifactId>json4s-ast_${scala.binary.version}</artifactId>
                                            <version>${json.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-client</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-typesystem</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>hive-bridge</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-notification</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-common</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>hdfs-model</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.scala-lang</groupId>
                                            <artifactId>scala-compiler</artifactId>
                                            <version>${scala.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.scala-lang</groupId>
                                            <artifactId>scala-reflect</artifactId>
                                            <version>${scala.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.scala-lang</groupId>
                                            <artifactId>scala-library</artifactId>
                                            <version>${scala.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.scala-lang</groupId>
                                            <artifactId>scalap</artifactId>
                                            <version>${scala.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.google.inject</groupId>
                                            <artifactId>guice</artifactId>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.google.inject.extensions</groupId>
                                            <artifactId>guice-multibindings</artifactId>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.google.inject.extensions</groupId>
                                            <artifactId>guice-servlet</artifactId>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.google.inject.extensions</groupId>
                                            <artifactId>guice-throwingproviders</artifactId>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.kafka</groupId>
                                            <artifactId>kafka_${scala.binary.version}</artifactId>
                                            <version>${kafka.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.kafka</groupId>
                                            <artifactId>kafka-clients</artifactId>
                                            <version>${kafka.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>aopalliance</groupId>
                                            <artifactId>aopalliance</artifactId>
                                            <version>${aopalliance.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>commons-configuration</groupId>
                                            <artifactId>commons-configuration</artifactId>
                                            <version>${commons-conf.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>commons-logging</groupId>
                                            <artifactId>commons-logging</artifactId>
                                            <version>${commons-logging.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>javax.inject</groupId>
                                            <artifactId>javax.inject</artifactId>
                                            <version>${javax-inject.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.codehaus.jettison</groupId>
                                            <artifactId>jettison</artifactId>
                                            <version>${jettison.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.codehaus.jettison</groupId>
                                            <artifactId>jettison</artifactId>
                                            <version>${jettison.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.thoughtworks.paranamer</groupId>
                                            <artifactId>paranamer</artifactId>
                                            <version>${paranamer.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.hive</groupId>
                                            <artifactId>hive-exec</artifactId>
                                            <version>${hive.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.hbase</groupId>
                                            <artifactId>hbase-common</artifactId>
                                            <version>${hbase.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.hadoop</groupId>
                                            <artifactId>hadoop-common</artifactId>
                                            <version>${hadoop.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.google.code.gson</groupId>
                                            <artifactId>gson</artifactId>
                                            <version>${gson.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>log4j</groupId>
                                            <artifactId>log4j</artifactId>
                                            <version>${log4j.version}</version>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-hook-shim</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/dependency/hook/storm</outputDirectory>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>false</overWriteSnapshots>
                                    <overWriteIfNewer>true</overWriteIfNewer>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>storm-bridge-shim</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>${project.groupId}</groupId>
                                            <artifactId>atlas-plugin-classloader</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>scala-compile-first</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>scala-test-compile-first</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                    <recompileMode>incremental</recompileMode>
                    <useZincServer>true</useZincServer>
                    <source>1.7</source>
                    <target>1.7</target>
                    <args>
                        <arg>-unchecked</arg>
                        <arg>-deprecation</arg>
                        <arg>-feature</arg>
                    </args>
                    <jvmArgs>
                        <jvmArg>-Xmx512m</jvmArg>
                        <jvmArg>-XX:MaxPermSize=128m</jvmArg>
                    </jvmArgs>
                    <!--
                    <javacArgs>
                        <javacArg>-source</javacArg>
                        <javacArg>${java.version}</javacArg>
                        <javacArg>-target</javacArg>
                        <javacArg>${java.version}</javacArg>
                    </javacArgs>
                    -->
                    <!-- The following plugin is required to use quasiquotes in Scala 2.10 and is used
                         by Spark SQL for code generation. -->
                    <!--<compilerPlugins>
                        <compilerPlugin>
                            <groupId>org.scalamacros</groupId>
                            <artifactId>paradise_${scala.version}</artifactId>
                            <version>${scala.macros.version}</version>
                        </compilerPlugin>
                    </compilerPlugins>-->
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <configuration>
                    <skip>${skipTests}</skip>
                    <!--only skip int tests -->
                    <httpConnector>
                        <port>31000</port>
                        <idleTimeout>60000</idleTimeout>
                    </httpConnector>
                    <war>../../webapp/target/atlas-webapp-${project.version}.war</war>
                    <daemon>true</daemon>
                    <webApp>
                        <contextPath>/</contextPath>
                        <descriptor>${project.basedir}/../../webapp/src/test/webapp/WEB-INF/web.xml</descriptor>
                        <extraClasspath>${project.basedir}/../../webapp/target/test-classes/</extraClasspath>
                    </webApp>
                    <useTestScope>true</useTestScope>
                    <systemProperties>
                        <systemProperty>
                            <name>log4j.configuration</name>
                            <value>file://${project.basedir}/../../distro/src/conf/atlas-log4j.xml</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.log.file</name>
                            <value>application.log</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.log.dir</name>
                            <value>${project.build.directory}/logs</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.data</name>
                            <value>${project.build.directory}/data</value>
                        </systemProperty>
                        <systemProperty>
                            <key>atlas.conf</key>
                            <value>${project.build.directory}/../../../typesystem/target/test-classes</value>
                        </systemProperty>
                        <systemProperty>
                            <key>atlas.home</key>
                            <value>${project.basedir}/target</value>
                        </systemProperty>
                    </systemProperties>
                    <stopKey>atlas-stop</stopKey>
                    <stopPort>31001</stopPort>
                    <stopWait>${jetty-maven-plugin.stopWait}</stopWait>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deploy-war</goal>
                        </goals>
                        <configuration>
                            <daemon>true</daemon>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.doxia</groupId>
                        <artifactId>doxia-module-twiki</artifactId>
                        <version>1.3</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>site</goal>
                        </goals>
                        <phase>prepare-package</phase>
                    </execution>
                </executions>
                <configuration>
                    <generateProjectInfo>false</generateProjectInfo>
                    <generateReports>false</generateReports>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <inherited>false</inherited>
                <executions>
                </executions>
            </plugin>

            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/models</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/../models</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>