<?xml version="1.0"?>
<!--
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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.sentry</groupId>
    <artifactId>sentry-provider</artifactId>
    <version>1.7.0</version>
  </parent>

  <artifactId>sentry-provider-db</artifactId>
  <name>Sentry Provider DB</name>

  <dependencies>
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
    </dependency>
    <dependency>
      <groupId>com.jolbox</groupId>
      <artifactId>bonecp</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-core-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-core-model-db</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-core-model-search</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-core-model-sqoop</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-core-model-kafka</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-provider-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-provider-file</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-policy-search</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.sentry</groupId>
      <artifactId>sentry-policy-kafka</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-shims</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-beeline</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libfb303</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libthrift</artifactId>
    </dependency>
    <dependency>
      <groupId>ant-contrib</groupId>
      <artifactId>ant-contrib</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-minikdc</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.jdo</groupId>
      <artifactId>jdo-api</artifactId>
    </dependency>
    <dependency>
      <groupId>com.codahale.metrics</groupId>
      <artifactId>metrics-core</artifactId>
      <version>${metrics.version}</version>
    </dependency>
    <dependency>
      <groupId>com.codahale.metrics</groupId>
      <artifactId>metrics-servlets</artifactId>
      <version>${metrics.version}</version>
    </dependency>
    <dependency>
      <groupId>com.codahale.metrics</groupId>
      <artifactId>metrics-jvm</artifactId>
      <version>${metrics.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jettyVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>${jettyVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.curator</groupId>
      <artifactId>curator-recipes</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.curator</groupId>
      <artifactId>curator-x-discovery</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.curator</groupId>
      <artifactId>curator-test</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-pool2</artifactId>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>${basedir}/src/main/java</sourceDirectory>
    <testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>${basedir}/src/main/java/org/apache/sentry/provider/db/service/model</directory>
        <includes>
          <include>package.jdo</include>
        </includes>
      </resource>
      <resource>
        <directory>${basedir}/src/main</directory>
        <includes>
          <include>webapp/*</include>
          <include>webapp/css/*</include>
        </includes>
      </resource>
    </resources>
    <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/gen/thrift/gen-javabean</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-maven-plugin</artifactId>
        <configuration>
          <api>JDO</api>
          <metadataIncludes>**/*.jdo</metadataIncludes>
          <verbose>true</verbose>
        </configuration>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <goals>
              <goal>enhance</goal>
            </goals>
          </execution>
        </executions>
      </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.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
            <reuseForks>false</reuseForks>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>datanucleus3</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <datanucleus-api-jdo.version>3.2.6</datanucleus-api-jdo.version>
        <datanucleus-core.version>3.2.12</datanucleus-core.version>
        <datanucleus-rdbms.version>3.2.12</datanucleus-rdbms.version>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.datanucleus</groupId>
          <artifactId>datanucleus-core</artifactId>
          <version>${datanucleus-core.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-rdbms</artifactId>
          <version>${datanucleus-rdbms.version}</version>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>datanucleus4</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <properties>
        <datanucleus-api-jdo.version>4.2.1</datanucleus-api-jdo.version>
        <datanucleus-core.version>4.1.6</datanucleus-core.version>
        <datanucleus-rdbms.version>4.1.7</datanucleus-rdbms.version>
        <datanucleus-jdo.version>3.2.0-m3</datanucleus-jdo.version>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.datanucleus</groupId>
          <artifactId>datanucleus-core</artifactId>
          <version>${datanucleus-core.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-rdbms</artifactId>
          <version>${datanucleus-rdbms.version}</version>
        </dependency>
        <dependency>
          <groupId>org.datanucleus</groupId>
          <artifactId>javax.jdo</artifactId>
          <version>${datanucleus-jdo.version}</version>
        </dependency>
      </dependencies>
    </profile>
    <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="-I ${thrift.home} --gen java:beans,hashcode"/>
                    <property name="thrift.gen.dir" value="${basedir}/src/gen/thrift"/>
                    <delete dir="${thrift.gen.dir}"/>
                    <mkdir dir="${thrift.gen.dir}"/>
                    <for param="thrift.file">
                      <path>
                        <fileset dir="${basedir}/src/main/resources/" includes="**/*.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}/src/main/resources/ -o ${thrift.gen.dir} @{thrift.file} " />
                        </exec>
                      </sequential>
                    </for>
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>enforce-property</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireProperty>
                      <property>thrift.home</property>
                    </requireProperty>
                  </rules>
                  <fail>true</fail>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
