<?xml version="1.0" encoding="UTF-8"?>
<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>
	<artifactId>eureka-webapp</artifactId>
	<packaging>war</packaging>
	<name>Eureka WebApp</name>
	<description>Eureka WebApp is the implementation 
		of the Eureka! Clinical Analytics web user interface.
	</description>

	<parent>
		<groupId>org.eurekaclinical</groupId>
		<artifactId>eureka</artifactId>
		<version>2.0-Alpha-25</version>
	</parent>

	<properties>
		<tomcat.port>8080</tomcat.port>
		<tomcat.httpsPort>8443</tomcat.httpsPort>
		<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
	</properties>

	<build>
		<finalName>eureka-webapp</finalName>
		<plugins>
			<plugin>
				<groupId>org.jasig.maven</groupId>
				<artifactId>maven-notice-plugin</artifactId>
				<configuration>
					<noticeTemplate>../etc/NOTICE.template</noticeTemplate>
					<licenseMapping>
						<param>../etc/license-mappings.xml</param>
					</licenseMapping>
				</configuration>
			</plugin>
			<plugin>
				<groupId>net.alchim31.maven</groupId>
				<artifactId>yuicompressor-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>compress</goal>
						</goals>
					</execution>
				</executions>  
				<configuration>
					<suffix>${maven.build.timestamp}</suffix>
					<includes>
						<include>assets/js/eureka.*.js</include>
						<include>assets/css/eureka.css</include>
						<include>app/eurekaApp.js</include>
						<include>app/eurekaApp.routes.js</include>
						<include>app/controllers/*.js</include>
						<include>app/services/*.js</include>
					</includes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
					<packagingIncludes>
						%regex[assets/js/eureka.*${maven.build.timestamp}.js],
						%regex[app/controllers/*${maven.build.timestamp}.js],
						%regex[app/services/*${maven.build.timestamp}.js],
						%regex[app/eurekaApp${maven.build.timestamp}.js],
						%regex[app/eurekaApp.routes${maven.build.timestamp}.js],
						%regex[app/controllers/js/*${maven.build.timestamp}.js],
						%regex[^(?!assets/js/eureka).*$]
					</packagingIncludes>
					<packagingExcludes>
						assets/css/eureka.css,
						node_modules/**,
						npm-debug.log
					</packagingExcludes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>license-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-tomcat-configs</id>
						<phase>process-classes</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/tomcat-config</outputDirectory>
							<resources>
								<resource>
									<directory>${basedir}/src/main/resources/tomcat-server-config</directory>
									<filtering>true</filtering>
									<includes>
										<include>context.xml</include>
										<include>logging.properties</include>
									</includes>
								</resource>
								<resource>
									<directory>${basedir}/src/main/resources/tomcat-server-config</directory>
									<filtering>false</filtering>
									<excludes>
										<exclude>context.xml</exclude>
										<exclude>logging.properties</exclude>
									</excludes>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<version>3.0.0</version>
				<configuration>
					<filesets>
						<fileset>
							<directory>src/main/webapp</directory>
							<includes>
								<include>bower_components/**</include>
								<include>build/**</include>
								<include>node_modules/**</include>
								<include>npm-debug.log</include>
								<include>dist/**</include>
							</includes>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>com.github.eirslett</groupId>
				<artifactId>frontend-maven-plugin</artifactId>
				<version>1.0</version>
				<configuration>
					<workingDirectory>src/main/webapp</workingDirectory>
					<installDirectory>target</installDirectory>
				</configuration>
				<executions>
					<execution>
						<id>install node and npm</id>
						<goals>
							<goal>install-node-and-npm</goal>
						</goals>
						<configuration>
							<nodeVersion>v4.4.3</nodeVersion>
							<npmVersion>2.15.1</npmVersion>
						</configuration>
					</execution>
					<execution>
						<id>npm install</id>
						<goals>
							<goal>npm</goal>
						</goals>
						<!-- Optional configuration which provides for running any npm command -->
						<configuration>
							<arguments>install</arguments>
						</configuration>
					</execution>
					<execution>
						<id>bower install</id>
						<goals>
							<goal>bower</goal>
						</goals>
						<configuration>
							<arguments>install</arguments>
						</configuration>
					</execution>
					<execution>
						<id>gulp build</id>
						<goals>
							<goal>gulp</goal>
						</goals>
						<configuration>
							<arguments>build</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey.jersey-test-framework</groupId>
			<artifactId>jersey-test-framework-grizzly2</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-server</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-json</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-client</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey.contribs</groupId>
			<artifactId>jersey-guice</artifactId>
		</dependency>
		<dependency>
			<groupId>com.google.inject</groupId>
			<artifactId>guice</artifactId>
		</dependency>
		<dependency>
			<groupId>com.google.inject.extensions</groupId>
			<artifactId>guice-servlet</artifactId>
		</dependency>
		<dependency>
			<groupId>com.google.inject.extensions</groupId>
			<artifactId>guice-persist</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.annotation</groupId>
			<artifactId>jsr250-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.1-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-jdk14</artifactId>
		</dependency>
		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jsp-api</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.eurekaclinical</groupId>
			<artifactId>eureka-common</artifactId>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
		</dependency>
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jasig.cas.client</groupId>
			<artifactId>cas-client-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eurekaclinical</groupId>
			<artifactId>scribe-up-ext</artifactId>
		</dependency>
	</dependencies>
</project>

