<?xml version="1.0"?>
<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">
  <!--
  /**
   * 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.
   */
  -->
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.hbase</groupId>
    <artifactId>hbase</artifactId>
    <version>1.1.13.503-mapr-636</version>
    <relativePath>..</relativePath>
  </parent>

  <artifactId>hbase-native-client</artifactId>
  <name>HBase - Native Library</name>

  <repositories>
    <!-- required for yet to be merged AsyncHBase changes-->
    <repository>
      <id>mapr public</id>
      <name>MapR Public Maven Repository</name>
      <url>http://repository.mapr.com/maven/</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
  </repositories>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <gtest.version>1.7.0</gtest.version>
    <gtest.md5>ef5e700c8a0f3ee123e2e0209b8b4961</gtest.md5>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.googlecode.maven-download-plugin</groupId>
        <artifactId>maven-download-plugin</artifactId>
        <version>1.1.0</version>
        <executions>
          <execution>
            <id>download-gtest</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>wget</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <skip>${maven.test.skip}</skip>
              <url>https://github.com/google/googletest/archive/release-${gtest.version}.zip</url>
              <unpack>true</unpack>
              <outputDirectory>${project.build.directory}</outputDirectory>
              <md5>${gtest.md5}</md5>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <!-- Skip the test executions defined in the parent module,
             since we run only integration tests in this module -->
        <executions>
          <execution>
            <id>default-test</id>
            <phase>none</phase>
          </execution>
          <execution>
            <id>secondPartTestsExecution</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>native-maven-plugin</artifactId>
        <version>1.0-alpha-7</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>generate-jni-headers</id>
            <phase>compile</phase>
            <goals>
              <goal>javah</goal>
            </goals>
            <configuration>
              <javahClassNames>
                <javahClassName>org.apache.hadoop.hbase.jni.CallbackHandlers</javahClassName>
              </javahClassNames>
              <javahOutputDirectory>${project.build.directory}/native/javah</javahOutputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <tarLongFileMode>gnu</tarLongFileMode>
          <appendAssemblyId>false</appendAssemblyId>
          <skipAssembly>false</skipAssembly>
          <descriptors>
            <descriptor>src/assembly/all.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>build-tarball</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>build-libhbase-binaries</id>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <target>
                <echo message="Building libHBase..."/>
                <exec executable="bash" failonerror="true" dir="${basedir}">
                  <arg value="gradlew" />
                  <arg value="hbase" />
                  <arg value="perftest" />
                  <arg value="-PbuildDir=${project.build.directory}/gradle" />
                  <arg value="-PjniIncludeDir=${project.build.directory}/native/javah" />
                </exec>
              </target>
            </configuration>
          </execution>

          <execution>
            <id>build-libhbase-tests</id>
            <phase>test-compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <skip>${maven.test.skip}</skip>
              <target unless="skipTests">
                <echo message="Building GTest..."/>
                <exec executable="cmake" failonerror="true"
                      dir="${project.build.directory}/gtest-${gtest.version}">
                  <arg value="-DBUILD_SHARED_LIBS=ON"/>
                  <arg value="-GUnix Makefiles"/>
                  <arg value="."/>
                </exec>
                <exec executable="make" failonerror="true"
                      dir="${project.build.directory}/gtest-${gtest.version}">
                  <arg value="gtest"/>
                </exec>
                <echo message="Building libHBase unit tests..."/>
                <exec executable="bash" failonerror="true" dir="${basedir}">
                  <arg value="gradlew" />
                  <arg value="unittests" />
                  <arg value="-PbuildDir=${project.build.directory}/gradle" />
                  <arg value="-PgoogleTestDir=${project.build.directory}/gtest-${gtest.version}" />
                </exec>
              </target>
            </configuration>
          </execution>
          <execution>
            <id>run-libhbase-unittests</id>
            <phase>integration-test</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <skip>${maven.test.skip}</skip>
              <target unless="skipTests">
                <echo message="Running libHBase unit tests..."/>
                <exec executable="${project.build.directory}/gradle/binaries/unittestsExecutable/unittests"
                      failonerror="true" dir="${basedir}">
                  <env key="PATH" path="${env.PATH}:${java.home}/bin/server:${project.build.directory}/gtest-${gtest.version}:${project.build.directory}/${project.build.finalName}/lib/native"/>
                  <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${java.home}/lib/${os.arch}/server:${project.build.directory}/gtest-${gtest.version}:${project.build.directory}/${project.build.finalName}/lib/native"/>
                  <env key="HBASE_CONF_DIR" file="${project.build.directory}/${project.build.finalName}/conf"/>
                  <env key="HBASE_LIB_DIR" file="${project.build.directory}/${project.build.finalName}/lib"/>
                  <env key="LIBHBASE_OPTS" value="-Dlibhbase.log.dir=${project.build.directory}/test-logs -Dlibhbase.log.name=unittests_java.log -Dlibhbase.logger=RFA -Dlibhbase.log.level=info"/>
                </exec>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <!--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>org.codehaus.mojo</groupId>
                    <artifactId>native-maven-plugin</artifactId>
                    <versionRange>[1.0-alpha-7,)</versionRange>
                    <goals>
                      <goal>javah</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>
                      com.googlecode.maven-download-plugin
                    </groupId>
                    <artifactId>maven-download-plugin</artifactId>
                    <versionRange>[1.1.0,)</versionRange>
                    <goals>
                      <goal>wget</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-client</artifactId>
      <exclusions>
        <exclusion>
          <artifactId>jsp-api-2.1</artifactId>
          <groupId>org.mortbay.jetty</groupId>
        </exclusion>
        <exclusion>
          <artifactId>commons-el</artifactId>
          <groupId>commons-el</groupId>
        </exclusion>
        <exclusion>
          <artifactId>commons-httpclient</artifactId>
          <groupId>commons-httpclient</groupId>
        </exclusion>
        <exclusion>
          <artifactId>commons-cli</artifactId>
          <groupId>commons-cli</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jsp-2.1</artifactId>
          <groupId>org.mortbay.jetty</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jetty-util</artifactId>
          <groupId>org.mortbay.jetty</groupId>
        </exclusion> 
        <exclusion>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-catalina</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-jasper</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.tomcat.embed</groupId>
          <artifactId>tomcat-embed-jasper</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>core</artifactId>
          <groupId>org.eclipse.jdt</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jetty</artifactId>
          <groupId>org.mortbay.jetty</groupId>
        </exclusion>
        <exclusion>
          <groupId>com.yammer.metrics</groupId>
          <artifactId>metrics-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.github.stephenc.high-scale-lib</groupId>
          <artifactId>high-scale-lib</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-io</groupId>
          <artifactId>commons-io</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-beanutils</groupId>
          <artifactId>commons-beanutils-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro-ipc</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.thrift</groupId>
          <artifactId>libthrift</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jruby</groupId>
          <artifactId>jruby-complete</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>servlet-api-2.5</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-jaxrs</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-xc</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jamon</groupId>
          <artifactId>jamon-runtime</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.google.protobuf</groupId>
          <artifactId>protobuf-java</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-json</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-server</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>hadoop-mapreduce-client-core</artifactId>
          <groupId>org.apache.hadoop</groupId>
        </exclusion>
        <exclusion>
          <artifactId>findbugs-annotations</artifactId>
          <groupId>com.github.stephenc.findbugs</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hbase</groupId>
      <artifactId>asynchbase</artifactId>
      <version>1.5.0-libhbase-SNAPSHOT</version>
      <exclusions>
        <exclusion>
          <artifactId>log4j-over-slf4j</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>guava</artifactId>
          <groupId>com.google.guava</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.zookeeper</groupId>
      <artifactId>zookeeper</artifactId>
      <exclusions>
        <exclusion>
          <artifactId>log4j</artifactId>
          <groupId>log4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>slf4j-log4j12</artifactId>
          <groupId>org.slf4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jline</artifactId>
          <groupId>jline</groupId>
        </exclusion>
        <exclusion>
          <artifactId>netty</artifactId>
          <groupId>org.jboss.netty</groupId>
        </exclusion>
      </exclusions>
    </dependency>

  </dependencies>

  <profiles>
    <!--
      profile against Hadoop 1.0.x.
      Activate using: mvn -Dhadoop.profile=1.1
    -->
    <profile>
      <id>hadoop-1.1</id>
      <activation>
        <property>
            <!--Below formatting for dev-support/generate-hadoopX-poms.sh-->
            <!--h1--><name>hadoop.profile</name><value>1.1</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-core</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <!--
      profile for building against Hadoop 2.
      This is the default.
    -->
    <profile>
      <id>hadoop-2.0</id>
      <activation>
        <property>
            <!--Below formatting for dev-support/generate-hadoopX-poms.sh-->
            <!--h2--><name>!hadoop.profile</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-common</artifactId>
          <exclusions>
            <exclusion>
              <groupId>javax.servlet.jsp</groupId>
              <artifactId>jsp-api</artifactId>
            </exclusion>
            <exclusion>
              <groupId>com.sun.jersey</groupId>
              <artifactId>jersey-server</artifactId>
            </exclusion>
            <exclusion>
              <groupId>javax.servlet</groupId>
              <artifactId>servlet-api</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.apache.tomcat</groupId>
              <artifactId>tomcat-catalina</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.apache.tomcat</groupId>
              <artifactId>tomcat-jasper</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.apache.tomcat.embed</groupId>
              <artifactId>tomcat-embed-jasper</artifactId>
            </exclusion>
            <exclusion>
              <artifactId>jersey-json</artifactId>
              <groupId>com.sun.jersey</groupId>
            </exclusion>
            <exclusion>
              <artifactId>jersey-core</artifactId>
              <groupId>com.sun.jersey</groupId>
            </exclusion>
            <exclusion>
              <artifactId>avro</artifactId>
              <groupId>org.apache.avro</groupId>
            </exclusion>
            <exclusion>
              <artifactId>jetty</artifactId>
              <groupId>org.mortbay.jetty</groupId>
            </exclusion>
            <exclusion>
              <artifactId>jetty-util</artifactId>
              <groupId>org.mortbay.jetty</groupId>
            </exclusion>
            <exclusion>
              <artifactId>commons-math3</artifactId>
              <groupId>org.apache.commons</groupId>
            </exclusion>
            <exclusion>
              <artifactId>commons-compress</artifactId>
              <groupId>org.apache.commons</groupId>
            </exclusion>
            <exclusion>
              <artifactId>commons-cli</artifactId>
              <groupId>commons-cli</groupId>
            </exclusion>
            <exclusion>
              <artifactId>jets3t</artifactId>
              <groupId>net.java.dev.jets3t</groupId>
            </exclusion>
            <exclusion>
              <artifactId>commons-httpclient</artifactId>
              <groupId>commons-httpclient</groupId>
            </exclusion>
            <exclusion>
              <artifactId>commons-el</artifactId>
              <groupId>commons-el</groupId>
            </exclusion>
            <exclusion>
              <artifactId>commons-digester</artifactId>
              <groupId>commons-digester</groupId>
            </exclusion>
            <exclusion>
              <artifactId>commons-io</artifactId>
              <groupId>commons-io</groupId>
            </exclusion>
            <exclusion>
              <groupId>xerces</groupId>
              <artifactId>xercesImpl</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-auth</artifactId>
          <exclusions>
            <exclusion>
              <artifactId>httpclient</artifactId>
              <groupId>org.apache.httpcomponents</groupId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </profile>

    <!--
      profile for building against Hadoop 3.0.x.
      Activate using: mvn -Dhadoop.profile=3.0
    -->
    <profile>
      <id>hadoop-3.0</id>
      <activation>
        <property>
          <name>hadoop.profile</name>
          <value>3.0</value>
        </property>
      </activation>
      <properties>
        <hadoop.version>3.0-SNAPSHOT</hadoop.version>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-common</artifactId>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

</project>
