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

<!--
  ~ 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 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.hadoop.metadata</groupId>
        <artifactId>metadata-governance</artifactId>
        <version>0.1-incubating-SNAPSHOT</version>
    </parent>
    <artifactId>metadata-webapp</artifactId>
    <description>Apache Metadata Web Application</description>
    <name>Apache Metadata Web Application</name>
    <packaging>war</packaging>

    <properties>
        <debug.jetty.daemon>true</debug.jetty.daemon>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.hadoop.metadata</groupId>
            <artifactId>metadata-typesystem</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop.metadata</groupId>
            <artifactId>metadata-repository</artifactId>
        </dependency>

        <!--<dependency>-->
            <!--<groupId>org.apache.hadoop.metadata</groupId>-->
            <!--<artifactId>metadata-client</artifactId>-->
        <!--</dependency>-->

        <dependency>
            <groupId>org.apache.hadoop.metadata</groupId>
            <artifactId>metadata-client</artifactId>
            <version>${version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>${hadoop.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-minikdc</artifactId>
            <version>${hadoop.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-hdfs</artifactId>
            <version>${hadoop.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- supports simple auth handler -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.2.5</version>
        </dependency>

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
        </dependency>

        <dependency>
            <groupId>com.tinkerpop.blueprints</groupId>
            <artifactId>blueprints-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-plus</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
        </dependency>

        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-json</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
        </dependency>

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

        <dependency>
            <groupId>com.google.inject.extensions</groupId>
            <artifactId>guice-servlet</artifactId>
            <version>3.0</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.3.1</version>
        </dependency>

        <dependency>
            <groupId>com.sun.jersey.contribs</groupId>
            <artifactId>jersey-guice</artifactId>
            <version>1.18.3</version>
        </dependency>

        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jsp-2.1</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>uber-javadocs</id>
                        <phase>site</phase>
                        <goals>
                            <goal>javadoc</goal>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <includeTransitiveDependencySources>false</includeTransitiveDependencySources>
                            <includeDependencySources>true</includeDependencySources>
                            <dependencySourceIncludes>
                                <dependencySourceInclude>org.apache.hadoop.metadata:*</dependencySourceInclude>
                            </dependencySourceIncludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <attachClasses>true</attachClasses>
                    <webResources>
                        <resource>
                            <directory>../dashboard/v3</directory>
                            <targetPath>dashboard</targetPath>
                        </resource>
                        <resource>
                            <directory>src/main/webapp/WEB-INF</directory>
                            <targetPath>WEB-INF</targetPath>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.enunciate</groupId>
                <artifactId>maven-enunciate-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>docs</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!-- the directory where to put the docs -->
                    <docsDir>${project.build.directory}/apidocs</docsDir>
                    <configFile>${basedir}/../src/build/enunciate.xml</configFile>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>keytool-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>clean</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generateKeyPair</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>generateKeyPair</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <dname>cn=metadata.incubator.apache.org</dname>
                    <keystore>${project.build.directory}/metadata.keystore</keystore>
                    <keypass>keypass</keypass>
                    <storepass>keypass</storepass>
                    <alias>metadata</alias>
                    <keyalg>RSA</keyalg>
                    <validity>100000</validity>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <skip>${skipTests}</skip>
                    <!--only skip int tests -->
                    <connectors>
                        <!--
                        <connector implementation="org.mortbay.jetty.security.SslSocketConnector">
                            <port>21443</port>
                            <maxIdleTime>60000</maxIdleTime>
                            <keystore>${project.build.directory}/../../webapp/target/metadata.keystore</keystore>
                            <keyPassword>metadata-passwd</keyPassword>
                            <password>metadata-passwd</password>
                        </connector>
                        -->
                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                            <port>21000</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                    <webApp>${project.build.directory}/metadata-webapp-${project.version}</webApp>
                    <contextPath>/</contextPath>
                    <useTestClasspath>true</useTestClasspath>
                    <systemProperties>
                        <systemProperty>
                            <name>metadata.log.dir</name>
                            <value>${project.build.directory}/logs</value>
                        </systemProperty>
                        <systemProperty>
                            <name>keystore.file</name>
                            <value>${project.build.directory}/../../webapp/target/metadata.keystore
                            </value>
                        </systemProperty>
                        <systemProperty>
                            <name>truststore.file</name>
                            <value>${project.build.directory}/../../webapp/target/metadata.keystore</value>
                        </systemProperty>
                        <systemProperty>
                            <name>metadata.home</name>
                            <value>${project.build.directory}</value>
                        </systemProperty>
                    </systemProperties>
                    <stopKey>metadata-stop</stopKey>
                    <stopPort>41001</stopPort>
                    <daemon>${debug.jetty.daemon}</daemon>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <daemon>true</daemon>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <inherited>true</inherited>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>
