<?xml version="1.0" encoding="UTF-8"?>
<!--
  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>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>18</version>
    <relativePath></relativePath>
  </parent>

  <groupId>org.apache.hive</groupId>
  <artifactId>hive-standalone-metastore</artifactId>
  <version>3.1.3</version>
  <packaging>jar</packaging>
  <name>Hive Standalone Metastore</name>

  <properties>
    <hive.version.shortname>3.1.0</hive.version.shortname>

    <!-- Build properties -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.useIncrementalCompilation>false</maven.compiler.useIncrementalCompilation>
    <maven.repo.local>${settings.localRepository}</maven.repo.local>
    <maven.assembly.plugin.version>2.3</maven.assembly.plugin.version>
    <maven.exec.plugin.version>1.6.0</maven.exec.plugin.version>

    <!-- Test Properties -->
    <log4j.conf.dir>${project.basedir}/src/test/resources</log4j.conf.dir>
    <test.tmp.dir>${project.build.directory}/tmp</test.tmp.dir>
    <test.warehouse.dir>${project.build.directory}/warehouse</test.warehouse.dir>
    <test.warehouse.scheme>file://</test.warehouse.scheme>
    <test.forkcount>1</test.forkcount>
    <skipITests>true</skipITests>
    <itest.jdbc.jars>set-this-to-colon-separated-full-path-list-of-jars-to-run-integration-tests</itest.jdbc.jars>
    <test.groups>org.apache.hadoop.hive.metastore.annotation.MetastoreUnitTest</test.groups>

    <!-- Plugin versions -->
    <ant.contrib.version>1.0b3</ant.contrib.version>
    <maven.antrun.plugin.version>1.7</maven.antrun.plugin.version>
    <checkstyle.conf.dir>${basedir}/checkstyle/</checkstyle.conf.dir>
    <maven.checkstyle.plugin.version>2.17</maven.checkstyle.plugin.version>
    <maven.surefire.version>2.20.1</maven.surefire.version>

    <!-- Dependency versions -->
    <antlr.version>3.5.2</antlr.version>
    <bonecp.version>0.8.0.RELEASE</bonecp.version>
    <commons-dbcp.version>1.4</commons-dbcp.version>
    <commons-lang3.version>3.2</commons-lang3.version>
    <datanucleus-api-jdo.version>4.2.4</datanucleus-api-jdo.version>
    <datanucleus-core.version>4.1.17</datanucleus-core.version>
    <datanucleus-jdo.version>3.2.0-m3</datanucleus-jdo.version>
    <datanucleus-rdbms.version>4.1.19</datanucleus-rdbms.version>
    <derby.version>10.10.2.0</derby.version>
    <dropwizard-metrics-hadoop-metrics2-reporter.version>0.1.2</dropwizard-metrics-hadoop-metrics2-reporter.version>
    <dropwizard.version>3.1.0</dropwizard.version>
    <guava.version>19.0</guava.version>
    <hadoop.version>3.1.0</hadoop.version>
    <hikaricp.version>2.6.1</hikaricp.version>
    <jackson.version>2.12.0</jackson.version>
    <javolution.version>5.5.1</javolution.version>
    <junit.version>4.11</junit.version>
    <libfb303.version>0.9.3</libfb303.version>
    <libthrift.version>0.9.3</libthrift.version>
    <log4j2.version>2.17.1</log4j2.version>
    <mockito-all.version>1.10.19</mockito-all.version>
    <orc.version>1.5.1</orc.version>
    <protobuf.version>2.5.0</protobuf.version>
    <sqlline.version>1.3.0</sqlline.version>
    <storage-api.version>2.7.0</storage-api.version>

    <!-- Thrift properties -->
    <thrift.home>you-must-set-this-to-run-thrift</thrift.home>
    <thrift.gen.dir>${basedir}/src/gen/thrift</thrift.gen.dir>
    <thrift.args>-I ${thrift.home} --gen java:beans,hashcode,generated_annotations=undated --gen cpp --gen php --gen py --gen rb</thrift.args>

  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.orc</groupId>
      <artifactId>orc-core</artifactId>
      <version>${orc.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.hadoop</groupId>
          <artifactId>hadoop-common</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.hive</groupId>
          <artifactId>hive-storage-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.github.joshelser</groupId>
      <artifactId>dropwizard-metrics-hadoop-metrics2-reporter</artifactId>
      <version>${dropwizard-metrics-hadoop-metrics2-reporter.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${guava.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>${protobuf.version}</version>
    </dependency>
    <dependency>
      <groupId>com.jolbox</groupId>
      <artifactId>bonecp</artifactId>
      <version>${bonecp.version}</version>
    </dependency>
    <dependency>
      <groupId>com.zaxxer</groupId>
      <artifactId>HikariCP</artifactId>
      <version>${hikaricp.version}</version>
    </dependency>
    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>${commons-dbcp.version}</version>
    </dependency>
    <dependency>
      <groupId>io.dropwizard.metrics</groupId>
      <artifactId>metrics-core</artifactId>
      <version>${dropwizard.version}</version>
    </dependency>
    <dependency>
      <groupId>io.dropwizard.metrics</groupId>
      <artifactId>metrics-jvm</artifactId>
      <version>${dropwizard.version}</version>
    </dependency>
    <dependency>
      <groupId>io.dropwizard.metrics</groupId>
      <artifactId>metrics-json</artifactId>
      <version>${dropwizard.version}</version>
    </dependency>
    <dependency>
      <groupId>javolution</groupId>
      <artifactId>javolution</artifactId>
      <version>${javolution.version}</version>
    </dependency>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr-runtime</artifactId>
      <version>${antlr.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${commons-lang3.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
      <version>${derby.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>${hadoop.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commmons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-distcp</artifactId>
      <version>${hadoop.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <version>${hadoop.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commmons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
     <groupId>org.apache.hadoop</groupId>
     <artifactId>hadoop-hdfs-client</artifactId>
     <version>${hadoop.version}</version>
     <optional>true</optional>
     <exclusions>
       <exclusion>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-log4j12</artifactId>
       </exclusion>
       <exclusion>
         <groupId>commmons-logging</groupId>
         <artifactId>commons-logging</artifactId>
       </exclusion>
     </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-mapreduce-client-core</artifactId>
      <version>${hadoop.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commmons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <!-- This is our one and only Hive dependency.-->
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-storage-api</artifactId>
      <version>${storage-api.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <version>${log4j2.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-1.2-api</artifactId>
      <version>${log4j2.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j2.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libfb303</artifactId>
      <version>${libfb303.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libthrift</artifactId>
      <version>${libthrift.version}</version>
    </dependency>
    <dependency>
      <groupId>org.datanucleus</groupId>
      <artifactId>datanucleus-api-jdo</artifactId>
      <version>${datanucleus-api-jdo.version}</version>
    </dependency>
    <dependency>
      <groupId>org.datanucleus</groupId>
      <artifactId>datanucleus-core</artifactId>
      <version>${datanucleus-core.version}</version>
    </dependency>
    <dependency>
      <groupId>org.datanucleus</groupId>
      <artifactId>datanucleus-rdbms</artifactId>
      <version>${datanucleus-rdbms.version}</version>
    </dependency>
    <dependency>
      <groupId>org.datanucleus</groupId>
      <artifactId>javax.jdo</artifactId>
      <version>${datanucleus-jdo.version}</version>
    </dependency>
    <dependency>
      <groupId>org.skyscreamer</groupId>
      <artifactId>jsonassert</artifactId>
      <version>1.4.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>sqlline</groupId>
      <artifactId>sqlline</artifactId>
      <version>${sqlline.version}</version>
    </dependency>

    <!-- test scope dependencies -->

    <dependency>
      <groupId>com.microsoft.sqlserver</groupId>
      <artifactId>mssql-jdbc</artifactId>
      <version>6.2.1.jre8</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito-all.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <!-- Note, this is LGPL.  But we're only using it in a test and not changing it, so I
        believe we are fine. -->
      <groupId>org.mariadb.jdbc</groupId>
      <artifactId>mariadb-java-client</artifactId>
      <version>2.2.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>9.3-1102-jdbc41</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>thriftif</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>generate-thrift-sources</id>
                <phase>generate-sources</phase>
                <configuration>
                  <target>
                    <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask"
                             classpathref="maven.plugin.classpath" />
                    <property name="thrift.args" value="${thrift.args}"/>
                    <property name="thrift.gen.dir" value="${thrift.gen.dir}"/>
                    <delete dir="${thrift.gen.dir}"/>
                    <mkdir dir="${thrift.gen.dir}"/>
                    <for param="thrift.file">
                      <path>
                        <fileset dir="." includes="src/main/thrift/*.thrift" />
                      </path>
                      <sequential>
                        <echo message="Generating Thrift code for @{thrift.file}"/>
                        <exec executable="${thrift.home}/bin/thrift"  failonerror="true" dir=".">
                          <arg line="${thrift.args} -I ${basedir}/include -I ${basedir}/.. -o ${thrift.gen.dir} @{thrift.file} " />
                        </exec>
                      </sequential>
                    </for>
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.google.code.maven-replacer-plugin</groupId>
            <artifactId>replacer</artifactId>
            <version>1.5.3</version>
            <executions>
              <execution>
                <id>process-thrift-sources-string-intern</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>replace</goal>
                </goals>
                <configuration>
                  <basedir>${basedir}/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/</basedir>
                  <includes>
                    <include>FieldSchema.java</include>
                    <include>Partition.java</include>
                    <include>SerDeInfo.java</include>
                    <include>StorageDescriptor.java</include>
                  </includes>
                  <tokenValueMap>${basedir}/src/main/resources/thrift-replacements.txt</tokenValueMap>
                  <regex>true</regex>
                  <quiet>false</quiet>
                </configuration>
              </execution>
              <execution>
                <id>process-thrift-sources-interface-annotations</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>replace</goal>
                </goals>
                <configuration>
                  <basedir>${basedir}/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/</basedir>
                  <filesToInclude>*.java</filesToInclude>
                  <replacements>
                    <replacement>
                      <token>public class</token>
                      <value>@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class</value>
                      <unescape>true</unescape>
                    </replacement>
                    <replacement>
                      <token>public static class</token>
                      <value>@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public static class</value>
                      <unescape>true</unescape>
                    </replacement>
                    <replacement>
                      <token>public interface</token>
                      <value>@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public interface</value>
                      <unescape>true</unescape>
                    </replacement>
                  </replacements>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
      <!--
    <profile>
      <id>checkin</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven.surefire.version}</version>
            <configuration>
              <includes>
                <include>**/Test*</include>
              </includes>
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
              <reuseForks>false</reuseForks>
              <forkCount>${test.forkcount}</forkCount>
              <argLine>-Xmx2048m</argLine>
              <failIfNoTests>false</failIfNoTests>
              <systemPropertyVariables>
                <build.dir>${project.build.directory}</build.dir>
                <datanucleus.schema.autoCreateAll>true</datanucleus.schema.autoCreateAll>
                <derby.version>${derby.version}</derby.version>
                <derby.stream.error.file>${test.tmp.dir}/derby.log</derby.stream.error.file>
                <log4j.debug>true</log4j.debug>
                <java.io.tmpdir>${test.tmp.dir}</java.io.tmpdir>
                <javax.jdo.option.ConnectionURL>jdbc:derby:memory:${test.tmp.dir}/junit_metastore_db;create=true</javax.jdo.option.ConnectionURL>
                <metastore.schema.verification>false</metastore.schema.verification>
                <test.tmp.dir>${test.tmp.dir}</test.tmp.dir>
                <metastore.warehouse.dir>${test.warehouse.scheme}${test.warehouse.dir}</metastore.warehouse.dir>
              </systemPropertyVariables>
              <additionalClasspathElements>
                <additionalClasspathElement>${log4j.conf.dir}</additionalClasspathElement>
              </additionalClasspathElements>
            </configuration>

          </plugin>


        </plugins>
      </build>
    </profile>
    -->
  </profiles>

  <build>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <includes>
          <include>package.jdo</include>
        </includes>
      </resource>
    </resources>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>${maven.antrun.plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>ant-contrib</groupId>
              <artifactId>ant-contrib</artifactId>
              <version>${ant.contrib.version}</version>
              <exclusions>
                <exclusion>
                  <groupId>ant</groupId>
                  <artifactId>ant</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${maven.checkstyle.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>${maven.exec.plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <!-- plugins are always listed in sorted order by groupId, artifectId -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>setup-test-dirs</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <delete dir="${test.tmp.dir}" />
                <delete dir="${test.warehouse.dir}" />
                <mkdir dir="${test.tmp.dir}" />
                <mkdir dir="${test.warehouse.dir}" />
              </target>
            </configuration>
          </execution>
          <execution>
            <id>generate-version-annotation</id>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <exec executable="bash" failonerror="true">
                  <arg value="${basedir}/src/main/resources/saveVersion.sh"/>
                  <arg value="${project.version}"/>
                  <arg value="${hive.version.shortname}"/>
                  <arg value="${basedir}/src"/>
                </exec>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>setup-metastore-scripts</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <mkdir dir="${test.tmp.dir}/scripts/metastore/upgrade" />
                <copy todir="${test.tmp.dir}/scripts/metastore/upgrade">
                  <fileset dir="${basedir}/src/main/sql/"/>
                </copy>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <configLocation>${checkstyle.conf.dir}/checkstyle.xml</configLocation>
          <propertyExpansion>config_loc=${checkstyle.conf.dir}</propertyExpansion>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.os72</groupId>
        <artifactId>protoc-jar-maven-plugin</artifactId>
        <version>3.5.1.1</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <protocArtifact>com.google.protobuf:protoc:2.5.0</protocArtifact>
              <addSources>none</addSources>
              <inputDirectories>
                <include>${basedir}/src/main/protobuf/org/apache/hadoop/hive/metastore</include>
              </inputDirectories>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- TODO MS-SPLIT findbugs plugin -->
      <!-- TODO MS-SPLIT javadoc plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>${maven.assembly.plugin.version}</version>
        <executions>
          <execution>
            <id>assemble</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <finalName>apache-hive-metastore-${project.version}</finalName>
              <descriptors>
                <descriptor>src/assembly/bin.xml</descriptor>
                <descriptor>src/assembly/src.xml</descriptor>
              </descriptors>
              <tarLongFileMode>gnu</tarLongFileMode>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.20.1</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <reuseForks>false</reuseForks>
          <argLine>-Xmx2048m</argLine>
          <failIfNoTests>false</failIfNoTests>
          <systemPropertyVariables>
            <log4j.debug>true</log4j.debug>
            <java.io.tmpdir>${test.tmp.dir}</java.io.tmpdir>
            <test.tmp.dir>${test.tmp.dir}</test.tmp.dir>
            <hive.in.test>true</hive.in.test>
          </systemPropertyVariables>
          <additionalClasspathElements>
            <additionalClasspathElement>${log4j.conf.dir}</additionalClasspathElement>
            <additionalClasspathElement>${itest.jdbc.jars}</additionalClasspathElement>
          </additionalClasspathElements>
          <skipITs>${skipITests}</skipITs> <!-- set this to false to run these tests -->
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surefire.version}</version>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <reuseForks>false</reuseForks>
          <forkCount>${test.forkcount}</forkCount>
          <argLine>-Xmx2048m</argLine>
          <failIfNoTests>false</failIfNoTests>
          <systemPropertyVariables>
            <build.dir>${project.build.directory}</build.dir>
            <datanucleus.schema.autoCreateAll>true</datanucleus.schema.autoCreateAll>
            <derby.version>${derby.version}</derby.version>
            <derby.stream.error.file>${test.tmp.dir}/derby.log</derby.stream.error.file>
            <log4j.debug>true</log4j.debug>
            <java.io.tmpdir>${test.tmp.dir}</java.io.tmpdir>
            <javax.jdo.option.ConnectionURL>jdbc:derby:memory:${test.tmp.dir}/junit_metastore_db;create=true</javax.jdo.option.ConnectionURL>
            <metastore.schema.verification>false</metastore.schema.verification>
            <test.tmp.dir>${test.tmp.dir}</test.tmp.dir>
            <metastore.warehouse.dir>${test.warehouse.scheme}${test.warehouse.dir}</metastore.warehouse.dir>
          </systemPropertyVariables>
          <additionalClasspathElements>
            <additionalClasspathElement>${log4j.conf.dir}</additionalClasspathElement>
          </additionalClasspathElements>
          <groups>${test.groups}</groups>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.10</version>
        <configuration>
          <excludes>
	    <exclude>binary-package-licenses/**</exclude>
            <exclude>DEV-README</exclude>
	    <exclude>**/src/main/sql/**</exclude>
            <exclude>**/README.md</exclude>
            <exclude>**/*.iml</exclude>
            <exclude>**/*.txt</exclude>
            <exclude>**/*.log</exclude>
            <exclude>**/*.arcconfig</exclude>
            <exclude>**/package-info.java</exclude>
            <exclude>**/*.properties</exclude>
            <exclude>**/*.q</exclude>
            <exclude>**/*.q.out</exclude>
            <exclude>**/*.xml</exclude>
            <exclude>**/gen/**</exclude>
            <exclude>**/patchprocess/**</exclude>
            <exclude>**/metastore_db/**</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/gen/thrift/gen-javabean</source>
                <source>${project.build.directory}/generated-sources</source>
                <source>src/gen/version</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <executable>java</executable>
          <arguments>
            <argument>-classpath</argument>
            <classpath/>
            <argument>org.apache.hadoop.hive.metastore.conf.ConfTemplatePrinter</argument>
            <argument>${project.build.directory}/generated-sources/conf/metastore-site.xml.template</argument>
          </arguments>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-maven-plugin</artifactId>
        <version>4.0.5</version>
        <configuration>
          <api>JDO</api>
          <verbose>false</verbose>
          <log4jConfiguration>${basedir}/src/main/resources/datanucleus-log4j.properties</log4jConfiguration>
          <metadataIncludes>**/*.jdo</metadataIncludes>
          <fork>false</fork>
        </configuration>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <goals>
              <goal>enhance</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.antlr</groupId>
        <artifactId>antlr3-maven-plugin</artifactId>
        <version>${antlr.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>antlr</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
          <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>


</project>
