<?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>com.iluwatar</groupId>
		<artifactId>naked-objects</artifactId>
		<version>1.21.0-SNAPSHOT</version>
	</parent>

	<artifactId>naked-objects-webapp</artifactId>

	<description>This module runs both the Wicket viewer and the Restfulobjects viewer in a single webapp configured to run using the datanucleus object store.</description>

	<packaging>war</packaging>

	<properties>
		<siteBaseDir>..</siteBaseDir>
	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
			</plugin>

			<!-- mvn package -->
			<plugin>
				<groupId>org.simplericity.jettyconsole</groupId>
				<artifactId>jetty-console-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>createconsole</goal>
						</goals>
						<configuration>
							<backgroundImage>${basedir}/src/main/jettyconsole/isis-banner.png</backgroundImage>
							<destinationFile>${project.build.directory}/${project.build.finalName}-jetty-console.jar</destinationFile>
						</configuration>
						<phase>package</phase>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>1.8</version>
				<executions>
					<execution>
						<phase>validate</phase>
						<goals>
							<goal>maven-version</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<warName>simpleapp</warName>
					<archive>
						<manifest>
							<addClasspath>false</addClasspath>
						</manifest>
						<manifestEntries>
							<Build-Time>${maven.build.timestamp}</Build-Time>
							<Build-Host>${agent.name}</Build-Host>
							<Build-User>${user.name}</Build-User>
							<Build-Maven>Maven ${maven.version}</Build-Maven>
							<Build-Java>${java.version}</Build-Java>
							<Build-OS>${os.name}</Build-OS>
							<Build-Label>${project.version}</Build-Label>
						</manifestEntries>
					</archive>
					<packagingExcludes>WEB-INF/lib/isis-core-webserver*.jar,
						WEB-INF/lib/javax.servlet-api-*.jar,
						WEB-INF/lib/javax.websocket-api-*.jar,
						WEB-INF/lib/jetty-all-*.jar</packagingExcludes>
				</configuration>
			</plugin>

		</plugins>
		<pluginManagement>
			<plugins>
				<!--This plugin's configuration is used to store Eclipse m2e settings 
					only. It has no influence on the Maven build itself. -->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.codehaus.mojo</groupId>
										<artifactId>build-helper-maven-plugin</artifactId>
										<versionRange>[1.5,)</versionRange>
										<goals>
											<goal>maven-version</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

	<dependencies>

		<!-- other modules in this project -->
		<dependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>naked-objects-dom</artifactId>
			<exclusions>
				<exclusion>
					<!-- so don't pick up transitive dependency to asm 4.0.0 -->
					<groupId>org.datanucleus</groupId>
					<artifactId>datanucleus-enhancer</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>naked-objects-fixture</artifactId>
			<exclusions>
				<exclusion>
					<!-- so don't pick up transitive dependency to asm 4.0.0 -->
					<groupId>org.datanucleus</groupId>
					<artifactId>datanucleus-enhancer</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- other isis components -->
		<dependency>
			<groupId>org.apache.isis.viewer</groupId>
			<artifactId>isis-viewer-wicket-impl</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.isis.core</groupId>
			<artifactId>isis-core-viewer-restfulobjects-server</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.isis.core</groupId>
			<artifactId>isis-core-security-shiro</artifactId>
		</dependency>


		<!-- isis core -->
		<dependency>
			<groupId>org.apache.isis.core</groupId>
			<artifactId>isis-core-runtime</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.isis.core</groupId>
			<artifactId>isis-core-wrapper</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.isis.core</groupId>
			<artifactId>isis-core-security</artifactId>
		</dependency>


		<!-- to run using WebServer (optional) -->
		<dependency>
			<groupId>org.apache.isis.core</groupId>
			<artifactId>isis-core-webserver</artifactId>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>


		<dependency>
			<groupId>org.apache.geronimo.specs</groupId>
			<artifactId>geronimo-servlet_3.0_spec</artifactId>
		</dependency>

		<!-- JDBC drivers (for jdo objectstore) -->
		<dependency>
			<groupId>org.hsqldb</groupId>
			<artifactId>hsqldb</artifactId>
		</dependency>

		<!-- <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> 
			<version>9.1-901.jdbc4</version> </dependency> -->

		<!-- mvn install:install-file -Dfile=sqljdbc4.jar \ -DgroupId=com.microsoft.sqlserver 
			\ -DartifactId=jdbc \ -Dversion=4.0 \ -Dpackaging=jar -->
		<!-- <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId> 
			<version>4.0</version> </dependency> -->

		<dependency>
			<groupId>org.lazyluke</groupId>
			<artifactId>log4jdbc-remix</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>


		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.junit.vintage</groupId>
			<artifactId>junit-vintage-engine</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>self-host</id>
			<build>
				<plugins>
					<!-- mvn -P self-host antrun:run -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<configuration>
							<tasks>
								<exec executable="java" failonerror="true">
									<arg value="-jar" />
                                    <arg value="${project.build.directory}/${project.build.finalName}-jetty-console.jar" />
								</exec>
							</tasks>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>intellij</id>
			<activation>
				<property>
					<name>idea.version</name>
				</property>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.apache.geronimo.specs</groupId>
					<artifactId>geronimo-servlet_3.0_spec</artifactId>
					<!-- Use 'compile' so can run o.a.i.WebServer from within IntelliJ; 
						can rely on servlet container to ignore this in war file -->
					<scope>compile</scope>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>jrebel</id>
			<properties>
				<!-- as used in the rebel.xml in the dom project -->
				<target.dir>target</target.dir>
				<isis-jrebel-plugin.packagePrefix>dom.simple,org.apache.isis.objectstore.jdo.applib</isis-jrebel-plugin.packagePrefix>
				<isis-jrebel-plugin.loggingLevel>warn</isis-jrebel-plugin.loggingLevel>
			</properties>
			<build>
				<plugins>
					<!-- mvn -P jrebel antrun:run \ -Djrebel.jar="C:/Users/Dan/.IdeaIC13/config/plugins/jr-ide-idea/lib/jrebel/jrebel.jar" 
						\ -Disis_jrebel_plugin.jar="C:/github/danhaywood/isis-jrebel-plugin/target/danhaywood-isis-jrebel-plugin-1.0.0-SNAPSHOT.jar" -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<configuration>
							<target>
								<property name="compile_classpath" refid="maven.compile.classpath" />
								<property name="runtime_classpath" refid="maven.runtime.classpath" />
								<property name="test_classpath" refid="maven.test.classpath" />
								<property name="plugin_classpath" refid="maven.plugin.classpath" />

								<echo message="" />
								<echo message="" />
								<echo message="jrebel.jar             = ${jrebel.jar}" />
								<echo message="isis_jrebel_plugin.jar = ${isis_jrebel_plugin.jar}" />
								<echo message="target.dir             = ${target.dir}" />
								<echo message="" />
								<echo message="" />

								<exec executable="java" failonerror="true">
									<arg value="-javaagent:${jrebel.jar}" />
									<arg value="-Drebel.log=false" />
									<arg value="-Drebel.check_class_hash=true" />
									<arg value="-Drebel.packages_exclude=org.apache.isis" />

									<!-- as used in the rebel.xml in the dom project -->
									<arg value="-Dproject.root=${project.basedir}/.." />
									<arg value="-Dtarget.dir=${target.dir}" />

									<arg value="-Drebel.plugins=${isis_jrebel_plugin.jar}" />
                                    <arg value="-Disis-jrebel-plugin.packagePrefix=${isis-jrebel-plugin.packagePrefix}" />
                                    <arg value="-Disis-jrebel-plugin.loggingLevel=${isis-jrebel-plugin.loggingLevel}" />
									<arg value="-XX:MaxPermSize=128m" />
									<arg value="-classpath" />
									<arg value="${runtime_classpath}" />
									<arg value="org.apache.isis.WebServer" />
								</exec>
							</target>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>


</project>
