<?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.hive</groupId>
    <artifactId>hive</artifactId>
    <version>3.1.2</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>hive-service</artifactId>
  <packaging>jar</packaging>
  <name>Hive Service</name>

  <properties>
    <hive.path.to.root>..</hive.path.to.root>
  </properties>

  <dependencies>
    <!-- dependencies are always listed in sorted order by groupId, artifectId -->
    <!-- intra-project -->
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-exec</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-metastore</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-service-rpc</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-llap-server</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>servlet-api-2.5</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>javax.servlet.jsp-api</artifactId>
      <version>${javax-servlet-jsp.version}</version>
    </dependency>

    <!-- inter-project -->
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>${commons-codec.version}</version>
    </dependency>
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>${commons-cli.version}</version>
    </dependency>
    <dependency>
      <groupId>net.sf.jpam</groupId>
      <artifactId>jpam</artifactId>
      <version>${jpam.version}</version>
        <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.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-runner</artifactId>
      <version>${jetty.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.mortbay.jasper</groupId>
          <artifactId>apache-jsp</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
    </dependency>
    <!-- used by thrift generated code -->
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>${commons-lang.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.apache.curator</groupId>
      <artifactId>curator-framework</artifactId>
      <version>${curator.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.curator</groupId>
      <artifactId>curator-recipes</artifactId>
      <version>${curator.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <version>${hadoop.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>commons-collections</groupId>
          <artifactId>commons-collections</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.servlet.jsp</groupId>
          <artifactId>jsp-api</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.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>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jetty-util</artifactId>
        </exclusion>
        <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.jamon</groupId>
      <artifactId>jamon-runtime</artifactId>
      <version>${jamon-runtime.version}</version>
    </dependency>

      <!-- intra-project -->
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-exec</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <classifier>tests</classifier>
    </dependency>
      <dependency>
        <groupId>org.apache.hive</groupId>
        <artifactId>hive-common</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
        <type>test-jar</type>
      </dependency>
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-standalone-metastore</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <!-- test inter-project -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tez</groupId>
      <artifactId>tez-api</artifactId>
      <version>${tez.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tez</groupId>
      <artifactId>tez-runtime-library</artifactId>
      <version>${tez.version}</version>
      <scope>test</scope>
        <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.tez</groupId>
      <artifactId>tez-dag</artifactId>
      <version>${tez.version}</version>
      <scope>test</scope>
        <exclusions>
             <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
          </exclusion>
          <exclusion>
            <groupId>commmons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-yarn-server-web-proxy</artifactId>
          </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>${mockito-all.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.directory.client.ldap</groupId>
      <artifactId>ldap-client-api</artifactId>
      <version>${apache-directory-clientapi.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.directory.server</groupId>
      <artifactId>apacheds-server-integ</artifactId>
      <version>${apache-directory-server.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.directory.server</groupId>
      <artifactId>apacheds-test-framework</artifactId>
      <version>${apache-directory-server.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>${basedir}/src/java</sourceDirectory>
    <testSourceDirectory>${basedir}/src/test</testSourceDirectory>
    <resources>
      <resource>
        <directory>${project.build.directory}</directory>
        <includes>
          <include>hive-webapps/**</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>${project.build.directory}/generated-sources/java</source>
                <source>${project.build.directory}/generated-jamon</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <!-- Generate web app sources -->
          <execution>
            <id>generate</id>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <property name="build.webapps"
                  location="${project.build.directory}/hive-webapps"/>
                <property name="src.webapps"
                  location="${basedir}/src/resources/hive-webapps"/>
                <property name="generated.sources"
                  location="${project.build.directory}/generated-sources"/>
                <mkdir dir="${build.webapps}"/>
                <copy todir="${build.webapps}">
                  <fileset dir="${src.webapps}">
                    <exclude name="**/*.jsp"/>
                    <exclude name="**/.*"/>
                  </fileset>
                </copy>
                <taskdef classname="org.apache.jasper.JspC"
                  name="jspcompiler" classpathref="maven.compile.classpath"/>
                <mkdir dir="${build.webapps}/hiveserver2/WEB-INF"/>
                <jspcompiler uriroot="${src.webapps}/hiveserver2"
                  outputdir="${generated.sources}/java"
                  package="org.apache.hive.generated.hiveserver2"
                  webxml="${build.webapps}/hiveserver2/WEB-INF/web.xml"/>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
        <plugin>
            <groupId>org.jamon</groupId>
            <artifactId>jamon-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>translate</goal>
                    </goals>
                    <configuration>
                        <templateSourceDir>src/jamon</templateSourceDir>
                        <templateOutputDir>target/generated-jamon</templateOutputDir>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!-- General plugins -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <configuration>
                <additionalProjectnatures>
                    <projectnature>org.jamon.project.jamonnature</projectnature>
                </additionalProjectnatures>
                <buildcommands>
                    <buildcommand>org.jamon.project.templateBuilder</buildcommand>
                    <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
                    <buildcommand>org.jamon.project.markerUpdater</buildcommand>
                </buildcommands>
                <additionalConfig>
                    <file>
                        <name>.settings/org.jamon.prefs</name>
                        <content># now
                            eclipse.preferences.version=1
                            templateSourceDir=src/main/jamon
                            templateOutputDir=target/generated-jamon
                        </content>
                    </file>
                </additionalConfig>
            </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>
    </plugins>
  </build>
</project>
