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

    Copyright (C) 2013 Facebook, Inc.

    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>
    <groupId>com.facebook</groupId>
<!--
    <artifactId>facebook-base-pom</artifactId>
    <version>2</version>
-->
    <artifactId>facebook-oss-pom</artifactId>
    <version>7</version>
  </parent>

  <groupId>com.facebook</groupId>
  <artifactId>swift-hive-metastore</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>

  <name>swift-hive-metastore</name>
  <description>Client API to access a Hive metastore</description>
  <url>https://github.com/facebook/swift-hive-metastore</url>

  <inceptionYear>2013</inceptionYear>

  <scm>
    <connection>scm:git:git://github.com/facebook/swift-hive-metastore.git</connection>
    <url>https://github.com/facebook/swift-hive-metastore</url>
    <tag>swift-hive-metastore-1.0</tag>
  </scm>

  <developers />

  <properties>
    <dep.airlift.version>0.79</dep.airlift.version>
    <dep.swift.version>0.9.0</dep.swift.version>
    <dep.nifty.version>0.9.0</dep.nifty.version>
    <dep.hive.version>0.11.0</dep.hive.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.airlift</groupId>
      <artifactId>configuration</artifactId>
      <version>${dep.airlift.version}</version>
    </dependency>

    <dependency>
      <groupId>io.airlift</groupId>
      <artifactId>log</artifactId>
      <version>${dep.airlift.version}</version>
    </dependency>

    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.1.0.Final</version>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libthrift</artifactId>
      <version>0.9.0</version>
    </dependency>

    <dependency>
      <groupId>com.facebook.nifty</groupId>
      <artifactId>nifty-client</artifactId>
      <version>${dep.nifty.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice</artifactId>
    </dependency>

    <dependency>
      <groupId>com.google.inject.extensions</groupId>
      <artifactId>guice-throwingproviders</artifactId>
    </dependency>

    <dependency>
      <groupId>com.facebook.swift</groupId>
      <artifactId>swift-annotations</artifactId>
      <version>${dep.swift.version}</version>
    </dependency>

    <dependency>
      <groupId>com.facebook.swift</groupId>
      <artifactId>swift-codec</artifactId>
      <version>${dep.swift.version}</version>
    </dependency>

    <dependency>
      <groupId>com.facebook.swift</groupId>
      <artifactId>swift-service</artifactId>
      <version>${dep.swift.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>annotations</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

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

    <dependency>
      <groupId>io.airlift</groupId>
      <artifactId>testing</artifactId>
      <version>${dep.airlift.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>io.airlift</groupId>
      <artifactId>bootstrap</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- The unbelievable mess that hive is ... -->
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-serde</artifactId>
      <version>${dep.hive.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>org.apache.hive</groupId>
          <artifactId>hive-common</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mockito</groupId>
          <artifactId>mockito-all</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.thrift</groupId>
          <artifactId>libfb303</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro-mapred</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-common</artifactId>
      <version>${dep.hive.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>org.apache.hive</groupId>
          <artifactId>hive-shims</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-cli</groupId>
          <artifactId>commons-cli</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-compress</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-shims</artifactId>
      <version>${dep.hive.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-core-asl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-mapper-asl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.zookeeper</groupId>
          <artifactId>zookeeper</artifactId>
        </exclusion>
      </exclusions>
    </dependency>


    <!-- And while it is hard to top hive, hadoop is even a bigger mess... -->
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-core</artifactId>
      <version>0.20.2</version>
      <scope>provided</scope>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>xmlenc</groupId>
          <artifactId>xmlenc</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-cli</groupId>
          <artifactId>commons-cli</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-httpclient</groupId>
          <artifactId>commons-httpclient</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-net</groupId>
          <artifactId>commons-net</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-el</groupId>
          <artifactId>commons-el</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jetty</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jetty-util</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jsp-api-2.1</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jsp-2.1</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>servlet-api-2.5</artifactId>
        </exclusion>
        <exclusion>
          <groupId>tomcat</groupId>
          <artifactId>jasper-runtime</artifactId>
        </exclusion>
        <exclusion>
          <groupId>tomcat</groupId>
          <artifactId>jasper-compiler</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.eclipse.jdt</groupId>
          <artifactId>core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>net.java.dev.jets3t</groupId>
          <artifactId>jets3t</artifactId>
        </exclusion>
        <exclusion>
          <groupId>net.sf.kosmosfs</groupId>
          <artifactId>kfs</artifactId>
        </exclusion>
        <exclusion>
          <groupId>hsqldb</groupId>
          <artifactId>hsqldb</artifactId>
        </exclusion>
        <exclusion>
          <groupId>oro</groupId>
          <artifactId>oro</artifactId>
        </exclusion>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.2.3</version>
      </dependency>

      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.2.3</version>
      </dependency>

      <dependency>
        <groupId>io.airlift</groupId>
        <artifactId>bootstrap</artifactId>
        <version>${dep.airlift.version}</version>
      </dependency>

      <dependency>
        <groupId>io.airlift</groupId>
        <artifactId>stats</artifactId>
        <version>${dep.airlift.version}</version>
      </dependency>

      <dependency>
        <groupId>io.airlift</groupId>
        <artifactId>units</artifactId>
        <version>${dep.airlift.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>2.5</version>
        </plugin>
        <plugin>
          <groupId>com.facebook.mojo</groupId>
          <artifactId>swift-maven-plugin</artifactId>
          <version>${dep.swift.version}</version>
          <configuration>
            <codeFlavor>java-ctor</codeFlavor>
            <addCloseableInterface>true</addCloseableInterface>
            <extendRuntimeException>true</extendRuntimeException>
            <usePlainJavaNamespace>true</usePlainJavaNamespace>
          </configuration>
        </plugin>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>com.facebook.mojo</groupId>
                    <artifactId>swift-maven-plugin</artifactId>
                    <versionRange>[0.0.0,)</versionRange>
                    <goals>
                      <goal>generate</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <configuration>
          <headerSections>
            <headerSection>
              <key>COPYRIGHT_SECTION</key>
              <defaultValue>Copyright (C) ${project.inceptionYear} Facebook, Inc.</defaultValue>
              <multiLineMatch>false</multiLineMatch>
            </headerSection>
          </headerSections>
          <validHeaders>
            <validHeader>${fb.main.basedir}/src/license/apache-header.txt</validHeader>
          </validHeaders>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit4</artifactId>
            <version>${dep.plugin.surefire.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- rebuild the thrift files -->
    <profile>
      <id>build-sources</id>
      <build>
	    <plugins>
          <plugin>
            <groupId>com.facebook.mojo</groupId>
            <artifactId>swift-maven-plugin</artifactId>
            <executions>
              <execution>
		        <phase>generate-sources</phase>
                <id>generate-swift-sources</id>
                <goals>
                  <goal>generate</goal>
                </goals>
                <configuration>
                  <idlFiles>
                    <directory>${basedir}/src/main/thrift</directory>
                    <includes>
                      <include>**/*.thrift</include>
                    </includes>
                  </idlFiles>
                </configuration>
              </execution>
            </executions>
	      </plugin>
	    </plugins>
      </build>
    </profile>
    <!-- use files in src/generated-sources -->
    <profile>
      <id>use-prebuilt-sources</id>
      <activation>
	    <activeByDefault>true</activeByDefault>
      </activation>
      <build>
	    <plugins>
	      <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
	        <executions>
              <execution>
		        <id>add-source</id>
		        <phase>generate-sources</phase>
		        <goals>
		          <goal>add-source</goal>
		        </goals>
		        <configuration>
		          <sources>
		            <source>src/generated-sources/swift</source>
		          </sources>
		        </configuration>
              </execution>
	        </executions>
	      </plugin>
	    </plugins>
      </build>
    </profile>
  </profiles>
</project>
