<?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:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>metadata-governance</artifactId>
        <groupId>org.apache.hadoop.metadata</groupId>
        <version>0.1-incubating-SNAPSHOT</version>
        <relativePath>../../</relativePath>
    </parent>
    <artifactId>hive-bridge</artifactId>
    <description>Apache Metadata Hive Bridge Module</description>
    <name>Apache Metadata Hive Bridge</name>
    <packaging>jar</packaging>

    <properties>
        <hive.version>1.2.0</hive.version>
        <calcite.version>0.9.2-incubating</calcite.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-minikdc</artifactId>
        </dependency>

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

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

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

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

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

        <dependency>
            <groupId>org.apache.hadoop.metadata</groupId>
            <artifactId>metadata-client</artifactId>
            <version>${version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
            <type>test-jar</type>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop.metadata</groupId>
            <artifactId>metadata-typesystem</artifactId>
        </dependency>

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

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-annotations</artifactId>
        </dependency>

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

        <dependency>
            <groupId>org.apache.hadoop.metadata</groupId>
            <artifactId>metadata-webapp</artifactId>
            <classifier>classes</classifier>
        </dependency>

        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-bridge-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/dependency/bridge/hive</outputDirectory>
                            <includeScope>compile</includeScope>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>${project.artifactId}</artifactId>
                                    <version>${project.version}</version>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/dependency/hook/hive</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-hook-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/dependency/hook/hive</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_2.10</artifactId>
                                    <version>${json.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.json4s</groupId>
                                    <artifactId>json4s-core_2.10</artifactId>
                                    <version>${json.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.json4s</groupId>
                                    <artifactId>json4s-ast_2.10</artifactId>
                                    <version>${json.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>metadata-client</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>metadata-typesystem</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>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <skip>${skipTests}</skip>
                    <!--only skip int tests -->
                    <connectors>
                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                            <port>21000</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                    <webApp>../../webapp/target/metadata-webapp-${project.version}.war</webApp>
                    <contextPath>/</contextPath>
                    <useTestClasspath>true</useTestClasspath>
                    <systemProperties>
                        <systemProperty>
                            <name>metadata.log.dir</name>
                            <value>${project.build.directory}/logs</value>
                        </systemProperty>
                        <systemProperty>
                            <name>metadata.conf</name>
                            <value>addons/hive-bridge/src/test/resources</value>
                        </systemProperty>
                    </systemProperties>
                    <stopKey>metadata-stop</stopKey>
                    <stopPort>41001</stopPort>
                </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>
                    <skip>false</skip>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <inherited>true</inherited>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>
