<?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.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>

	<profiles>
		<profile>
			<id>hadoop-2</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.apache.hadoop</groupId>
					<artifactId>hadoop-client</artifactId>
					<scope>test</scope>
				</dependency>
			</dependencies>
		</profile>
	</profiles>

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

		<dependency>
			<groupId>org.apache.hadoop.metadata</groupId>
			<artifactId>metadata-repository</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>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>
	</dependencies>

	<build>
		<pluginManagement>
			<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>
						<webResources>
							<resource>
								<directory>src/main/webapp/WEB-INF</directory>
								<targetPath>WEB-INF</targetPath>
							</resource>
						</webResources>
					</configuration>
				</plugin>

				<plugin>
					<artifactId>maven-resources-plugin</artifactId>
					<version>2.6</version>
					<executions>
						<execution>
							<id>copy-resources</id>
							<phase>validate</phase>
							<goals>
								<goal>copy-resources</goal>
							</goals>
							<configuration>
								<outputDirectory>${project.build.directory}/webapps</outputDirectory>
								<resources>
									<resource>
										<directory>src/conf</directory>
										<filtering>true</filtering>
									</resource>
								</resources>
							</configuration>
						</execution>
					</executions>
				</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>genkey</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>metadata-passwd</keypass>
						<storepass>metadata-passwd</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>${skipITs}</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>hadoop.conf.dir</name>
								<value>${project.build.directory}/webapps/hadoop/conf</value>
							</systemProperty>
							<systemProperty>
								<name>hadoop.tmp.dir</name>
								<value>${project.build.directory}/tmp-hadoop-${user.name}</value>
							</systemProperty>
							<systemProperty>
								<name>hadoop.log.dir</name>
								<value>${project.build.directory}/logs</value>
							</systemProperty>
							<systemProperty>
								<name>system.lib.location</name>
								<value>${project.build.directory}/dependency</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>
						</systemProperties>
						<stopKey>metadata-stop</stopKey>
						<stopPort>41001</stopPort>
					</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>
			</plugins>
		</pluginManagement>
	</build>
</project>
