<?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="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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.atlas</groupId>
        <artifactId>apache-atlas</artifactId>
        <version>0.8-incubating-SNAPSHOT</version>
    </parent>
    <artifactId>atlas-webapp</artifactId>
    <description>Apache Atlas Web Application</description>
    <name>Apache Atlas Web Application</name>
    <packaging>war</packaging>

    <properties>
        <projectBaseDir>${project.basedir}/..</projectBaseDir>
        <debug.jetty.daemon>true</debug.jetty.daemon>
        <packages.to.exclude />
    </properties>

    <profiles>
        <profile>
            <id>jdk7</id>
            <activation>
                <jdk>[1.7,1.8)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.enunciate</groupId>
                        <artifactId>maven-enunciate-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>docs</goal>
                                </goals>
                                <phase>site</phase>
                            </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>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- default profile is for external HBase and Solr - hence not packaging those jars -->
            <id>dist</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <packages.to.exclude>WEB-INF/lib/titan-berkeleyje-${titan.version}.jar,WEB-INF/lib/je-*.jar,WEB-INF/lib/titan-es-${titan.version}.jar,WEB-INF/lib/elasticsearch-*.jar</packages.to.exclude>
            </properties>
        </profile>

        <profile>
            <id>berkeley-elasticsearch</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <packages.to.exclude>WEB-INF/lib/je-*.jar</packages.to.exclude>
            </properties>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-common</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-typesystem</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-repository</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-client</artifactId>
        </dependency>

	    <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-authorization</artifactId>
	    <version>${project.version}</version>	
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-notification</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-minikdc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-hdfs</artifactId>
        </dependency>
   
        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-catalog</artifactId>
        </dependency>

        <!-- supports simple auth handler -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </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>org.apache.commons</groupId>
            <artifactId>commons-lang3</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.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
        </dependency>

        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</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>
        </dependency>

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

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

        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp</artifactId>
        </dependency>

        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.el</artifactId>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
        </dependency>

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

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>

        <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${spring.version}</version>
        </dependency>

        <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring.version}</version>
        </dependency>

        <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring.version}</version>
        </dependency>

        <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-core</artifactId>
                <version>${spring.security.version}</version>
        </dependency>

        <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-web</artifactId>
                <version>${spring.security.version}</version>
        </dependency>

        <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-config</artifactId>
                <version>${spring.security.version}</version>
        </dependency>

        <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-ldap</artifactId>
                <version>${spring.security.version}</version>
        </dependency>
        <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>${javax.servlet.version}</version>
        </dependency>
        <dependency>
                <groupId>org.springframework.ldap</groupId>
                <artifactId>spring-ldap-core</artifactId>
                <version>${spring-ldap-core.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-dashboardv2</artifactId>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>3.4</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.atlas</groupId>
            <artifactId>atlas-typesystem</artifactId>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <archiveClasses>true</archiveClasses>
                    <attachClasses>true</attachClasses>
                    <overlays>
                        <overlay>
                            <groupId>org.apache.atlas</groupId>
                            <artifactId>atlas-dashboardv2</artifactId>
                        </overlay>
                        <overlay>
                             <!-- empty groupId/artifactId represents the current build -->
                        </overlay>
                    </overlays>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                    <packagingExcludes>
                        ${packages.to.exclude}
                    </packagingExcludes>
                </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=atlas.incubator.apache.org</dname>
                    <keystore>${project.build.directory}/atlas.keystore</keystore>
                    <keypass>keypass</keypass>
                    <storepass>keypass</storepass>
                    <alias>atlas</alias>
                    <keyalg>RSA</keyalg>
                    <validity>100000</validity>
                </configuration>
            </plugin>

            <!-- Running unit tests in pre-integration-test phase after war is built -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemProperties>
                        <user.dir>${project.basedir}</user.dir>
                        <projectBaseDir>${project.basedir}/..</projectBaseDir>
                    </systemProperties>
                    <!--<skipTests>true</skipTests>-->
                    <forkMode>always</forkMode>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <argLine>-Djava.awt.headless=true -Dproject.version=${project.version}
                        -Dhadoop.tmp.dir=${project.build.directory}/tmp-hadoop-${user.name}
                        -Xmx1024m -XX:MaxPermSize=512m
                    </argLine>
                    <excludes>
                        <exclude>**/*Base*</exclude>
                    </excludes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-testng</artifactId>
                        <version>2.18.1</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>default-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <configuration>
                    <skip>${skipTests}</skip>
                    <!--only skip int tests -->
                    <httpConnector>
                        <port>31000</port>
                        <idleTimeout>60000</idleTimeout>
                    </httpConnector>
                    <war>${project.build.directory}/atlas-webapp-${project.version}.war</war>
                    <daemon>true</daemon>
                    <webAppSourceDirectory>webapp/src/test/webapp</webAppSourceDirectory>
                    <webApp>
                        <contextPath>/</contextPath>
                        <descriptor>${project.basedir}/src/test/webapp/WEB-INF/web.xml</descriptor>
                        <!-- ${project.build.directory}/atlas-webapp-${project.version} -->
                        <extraClasspath>${project.build.directory}/../../webapp/target/test-classes/</extraClasspath>
                    </webApp>
                    <useTestScope>true</useTestScope>
                    <systemProperties>
                        <systemProperty>
                            <name>log4j.configuration</name>
                            <value>file://${project.build.directory}/../../distro/src/conf/atlas-log4j.xml</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.log.file</name>
                            <value>application.log</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.log.dir</name>
                            <value>${project.build.directory}/logs</value>
                        </systemProperty>
                        <systemProperty>
                            <name>keystore.file</name>
                            <value>${project.build.directory}/../../webapp/target/atlas.keystore
                            </value>
                        </systemProperty>
                        <systemProperty>
                            <name>truststore.file</name>
                            <value>${project.build.directory}/../../webapp/target/atlas.keystore</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.home</name>
                            <value>${project.build.directory}</value>
                        </systemProperty>
                        <systemProperty>
                            <name>atlas.data</name>
                            <value>${project.build.directory}/data</value>
                        </systemProperty>
                        <systemProperty>
                            <key>atlas.conf</key>
                            <value>${project.build.directory}/../../typesystem/target/test-classes</value>
                        </systemProperty>
                    </systemProperties>
                    <stopKey>atlas-stop</stopKey>
                    <stopPort>31001</stopPort>
                    <stopWait>${jetty-maven-plugin.stopWait}</stopWait>
                    <daemon>${debug.jetty.daemon}</daemon>
                    <testClassesDirectory>${project.build.directory}/../../webapp/target/test-classes/</testClassesDirectory>
                    <useTestClasspath>true</useTestClasspath>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deploy-war</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
