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

	<parent>
		<groupId>com.atlassian</groupId>
		<artifactId>jira-portfolio-main</artifactId>
		<version>1.8.7-D20150217T125021</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<modelVersion>4.0.0</modelVersion>
	<artifactId>jira-portfolio-common</artifactId>
	<version>1.8.7-D20150217T125021</version>

	<name>JIRA Portfolio [Frontend and Commons]</name>

	<properties>
		<maven.deploy.skip>true</maven.deploy.skip>

		<gem.home>.gems</gem.home>
		<gem.bin>${gem.home}/bin</gem.bin>
		<node.bin>./node</node.bin>
		<node.modules.bin>node_modules/.bin</node.modules.bin>

		<!-- is overriden by a windows os profile -->
		<path.separator>:</path.separator>
		<gem.executable>gem</gem.executable>
		<additional.path></additional.path>
		<grunt.executable>grunt</grunt.executable>
		<gson.version>2.3.1</gson.version>
        <includes></includes>
	</properties>

	<dependencies>

		<dependency>
			<groupId>com.atlassian</groupId>
			<artifactId>jira-portfolio-scheduling</artifactId>
		</dependency>

		<dependency>
			<groupId>net.objectlab.kit</groupId>
			<artifactId>datecalc-common</artifactId>
			<version>1.2.0</version>
		</dependency>

		<dependency>
			<groupId>net.objectlab.kit</groupId>
			<artifactId>datecalc-joda</artifactId>
			<version>1.2.0</version>
		</dependency>
		<dependency>
			<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>1.9</version>
		</dependency>

		<dependency>
			<groupId>commons-dbutils</groupId>
			<artifactId>commons-dbutils</artifactId>
			<version>1.5</version>
		</dependency>

		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.3.1</version>
		</dependency>

		<!-- GSON -->

		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>${gson.version}</version>
		</dependency>

		<!-- inherited dependencies; versions specified in common.pom -->

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

		<dependency>
			<groupId>com.atlassian.pocketknife</groupId>
			<artifactId>jira-pocketknife-enablement</artifactId>
		</dependency>

		<!-- should be required by pocketknife! -->

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>

		<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>jsr311-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>javax.mail</groupId>
			<artifactId>mail</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
		</dependency>

		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
		</dependency>

		<dependency>
			<groupId>joda-time</groupId>
			<artifactId>joda-time</artifactId>
			<version>[2.3,)</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.squareup.okhttp</groupId>
			<artifactId>okhttp</artifactId>
		</dependency>

		<!-- OBH: add dependency to active objects acc. to https://developer.atlassian.com/display/DOCS/Getting+Started+with+Active+Objects -->

		<dependency>
			<groupId>com.atlassian.activeobjects</groupId>
			<artifactId>activeobjects-plugin</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.sal</groupId>
			<artifactId>sal-api</artifactId>
			<version>2.4.1</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.4</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-client</artifactId>
			<version>1.17.1</version>
			<scope>test</scope>
		</dependency>

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

	</dependencies>

	<build>

		<resources>

			<resource>
				<directory>src/main/resources</directory>
				<includes>
					<include>**/*.properties</include>
					<include>**/plans/*.xml</include>
				</includes>
				<filtering>true</filtering>
			</resource>

		</resources>

		<plugins>

			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>com.atlassian.maven.plugins</groupId>
				<artifactId>maven-clover2-plugin</artifactId>
				<configuration>
					<licenseLocation>${basedir}/../builds/clover.license</licenseLocation>
					<contextFilters>property,constructor,static</contextFilters>
                    <includesList>${includes}</includesList>
				</configuration>
				<executions>
					<execution>
						<id>setup</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>instrument</goal>
						</goals>
						<configuration>
							<!--<includesTestSourceRoots>false</includesTestSourceRoots>-->
						</configuration>
					</execution>
					<execution>
						<id>aggregate</id>
						<phase>package</phase>
						<goals>
							<goal>aggregate</goal>
						</goals>
					</execution>
					<execution>
						<id>report</id>
						<phase>post-integration-test</phase>
						<goals>
							<goal>clover</goal>
						</goals>
					</execution>
					<execution>
						<id>check</id>
						<phase>verify</phase>
						<goals>
							<goal>check</goal>
						</goals>
						<configuration>
                            <targetPercentage>15.0000%</targetPercentage>
                            <methodPercentage>11.0000%</methodPercentage>
                            <statementPercentage>15.0000%</statementPercentage>
                            <conditionalPercentage>15.0000%</conditionalPercentage>
                            <!--Started at (13 Feb 2015):-->
                            <!--[ERROR] Total coverage of 15.2923% did not meet target of 110.0000%-->
                            <!--[ERROR] Method coverage of 11.5942% did not meet target of 110.0000%-->
                            <!--[ERROR] Statement coverage of 16.1822% did not meet target of 110.0000%-->
                            <!--[ERROR] Conditional coverage of 15.2392% did not meet target of 110.0000%-->
						</configuration>
					</execution>
				</executions>
			</plugin>

		</plugins>

	</build>

	<profiles>

		<profile>
			<id>jira-it</id>
			<activation>
				<property>
					<name>jiraIT</name>
				</property>
			</activation>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration>
							<skipTests>true</skipTests>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>windows-settings</id>
			<activation>
				<os>
					<family>Windows</family>
				</os>
			</activation>

			<properties>
				<path.separator>;</path.separator>
				<grunt.executable>grunt.cmd</grunt.executable>
			</properties>
		</profile>

		<profile>
			<id>client-build</id>
			<activation>
				<property>
					<name>!skipClient</name>
				</property>
			</activation>

			<build>

				<plugins>

					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.3.2</version>

						<executions>

							<execution>
								<id>install-gem-sass</id>
								<phase>initialize</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>

									<executable>${gem.executable}</executable>

									<arguments>
										<argument>install</argument>
										<argument>--install-dir</argument>
										<argument>${gem.home}</argument>
										<argument>--no-rdoc</argument>
										<argument>--no-ri</argument>
										<argument>sass</argument>
										<argument>-v</argument>
										<argument>3.4.5</argument>
									</arguments>

									<workingDirectory>${basedir}/../</workingDirectory>

									<environmentVariables>
										<PATH>${env.PATH}${additional.path}</PATH>
									</environmentVariables>

								</configuration>
							</execution>

							<execution>
								<id>install-gem-compass</id>
								<phase>initialize</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>

									<executable>${gem.executable}</executable>

									<arguments>
										<argument>install</argument>
										<argument>--install-dir</argument>
										<argument>${gem.home}</argument>
										<argument>--no-rdoc</argument>
										<argument>--no-ri</argument>
										<argument>compass</argument>
										<argument>-v</argument>
										<argument>1.0.1</argument>
									</arguments>

									<workingDirectory>${basedir}/../</workingDirectory>

									<environmentVariables>
										<PATH>${env.PATH}${additional.path}</PATH>
									</environmentVariables>

								</configuration>
							</execution>

							<execution>
								<id>install-gem-breakpoint</id>
								<phase>initialize</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>

									<executable>${gem.executable}</executable>

									<arguments>
										<argument>install</argument>
										<argument>--install-dir</argument>
										<argument>${gem.home}</argument>
										<argument>--no-rdoc</argument>
										<argument>--no-ri</argument>
										<argument>breakpoint</argument>
										<argument>-v</argument>
										<argument>2.5.0</argument>
									</arguments>

									<workingDirectory>${basedir}/../</workingDirectory>

									<environmentVariables>
										<PATH>${env.PATH}${additional.path}</PATH>
									</environmentVariables>

								</configuration>
							</execution>

							<execution>
								<id>grunt-build</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>

									<executable>${node.modules.bin}/${grunt.executable}</executable>

									<workingDirectory>${basedir}/../</workingDirectory>
									<environmentVariables>
										<GEM_HOME>${gem.home}</GEM_HOME>
										<PATH>${env.PATH}${path.separator}${node.modules.bin}${path.separator}${gem.bin}${path.separator}${node.bin}</PATH>
									</environmentVariables>
								</configuration>
							</execution>
						</executions>

					</plugin>

					<plugin>
						<groupId>com.github.eirslett</groupId>
						<artifactId>frontend-maven-plugin</artifactId>
						<version>0.0.16</version>

						<!-- optional -->
						<configuration>
							<workingDirectory>${basedir}/../</workingDirectory>
						</configuration>

						<executions>

							<!-- note that the following two executions are defined twice, once for phase clean and once
								 for phase generate-resources -->

							<execution>

								<id>phase-clean-nodeandnpm</id>
								<goals>
									<goal>install-node-and-npm</goal>
								</goals>
								<phase>pre-clean</phase>
								<configuration>
									<nodeVersion>v0.10.30</nodeVersion>
									<npmVersion>1.4.21</npmVersion>
									<workingDirectory>${basedir}/../</workingDirectory>
								</configuration>

							</execution>

							<execution>

								<id>phase-clean-npminstall</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>pre-clean</phase>
								<configuration>
									<arguments>install</arguments>
								</configuration>

							</execution>

							<execution>

								<id>phase-generate-resource-nodeandnpm</id>
								<goals>
									<goal>install-node-and-npm</goal>
								</goals>
								<phase>validate</phase>
								<configuration>
									<nodeVersion>v0.10.30</nodeVersion>
									<npmVersion>1.4.21</npmVersion>
									<workingDirectory>${basedir}/../</workingDirectory>
								</configuration>

							</execution>

							<execution>

								<id>phase-generate-resources-npminstall</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>initialize</phase>
								<configuration>
									<arguments>install</arguments>
								</configuration>

							</execution>

							<execution>
								<id>grunt-clean</id>
								<goals>
									<goal>grunt</goal>
								</goals>
								<phase>clean</phase>
								<configuration>
									<arguments>clean</arguments>
								</configuration>
							</execution>


							<!-- Client side unit tests via karma  -->
							<execution>
								<id>jasmine-tests</id>
								<goals>
									<goal>karma</goal>
								</goals>

								<phase>test</phase>

								<configuration>
									<karmaConfPath>karma.conf.ci.js</karmaConfPath>
								</configuration>
							</execution>

						</executions>
					</plugin>

				</plugins>

			</build>
		</profile>

	</profiles>

</project>
