<?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.rm</groupId>
		<artifactId>portfolio-1</artifactId>
		<version>8.21.1-int-0015</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<modelVersion>4.0.0</modelVersion>

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

	<name>Advanced Roadmaps for Jira</name>
	<description>Project and portfolio management for Atlassian Jira.</description>

	<packaging>${packaging.type}</packaging>

	<properties>

		<maven.resources.overwrite>true</maven.resources.overwrite>
		<maven.deploy.skip>false</maven.deploy.skip>

		<packaging.type>jar</packaging.type>

		<jira.it.acceptance.test.pattern>it/acceptance/**/*Test.java</jira.it.acceptance.test.pattern>

		<amps.resources>${basedir}/../../builds/jira-resources/jira-7-renaissance.zip</amps.resources>
		<amps.resources.testdata>${basedir}/../../builds/jira-resources/generated-test-resources.zip</amps.resources.testdata>

		<!-- Jira 6 compatible database with Portfolio licensed -->
		<amps.resources.jira6>${basedir}/../../builds/jira-resources/jira-6.zip</amps.resources.jira6>
		<!-- jira compatible database initial data and postgres configuration for postgres database runs/wiredtests -->
		<amps.resources.postgres>${basedir}/../../builds/jira-resources/generated-postgres-empty-resources.zip</amps.resources.postgres>
		<!-- Maps the directory that will be mounted as volume in the docker image - contains database backup script which will be important on docker startup. -->
		<docker.postgres.init.folder>${basedir}/../../builds/databases/postgres/init-empty:/docker-entrypoint-initdb.d</docker.postgres.init.folder>

		<amps.resources.mysql>${basedir}/../../builds/jira-resources/generated-mysql-empty-resources.zip</amps.resources.mysql>
		<docker.mysql.init.folder>${basedir}/../../builds/databases/mysql/init-empty:/docker-entrypoint-initdb.d</docker.mysql.init.folder>

		<!-- default environment -->
		<wiredtests.script>wiredtests</wiredtests.script>

	</properties>

	<dependencies>

		<!-- commons -->

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>jira-portfolio-jira-common</artifactId>
			<version>${project.version}</version>
			<exclusions>
				<exclusion>
					<groupId>joda-time</groupId>
					<artifactId>joda-time</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- bridge implementations -->

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>portfolio-jira-bridge-impl</artifactId>
			<version>${project.version}</version>
		</dependency>


		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>portfolio-agile-api-impl</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>portfolio-agile-api-jpo</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>portfolio-2-bridge-0.0</artifactId>
			<version>${project.version}</version>
		</dependency>

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

		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>jira-api</artifactId>
			<version>${jira.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>jira-core</artifactId>
			<version>${jira.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</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>
		</dependency>

		<dependency>
			<groupId>com.atlassian.sal</groupId>
			<artifactId>sal-api</artifactId>
		</dependency>

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

		<!-- Licensing -->

		<dependency>
			<groupId>com.atlassian.upm</groupId>
			<artifactId>licensing-api</artifactId>
			<version>${upm.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.upm</groupId>
			<artifactId>upm-api</artifactId>
			<version>${upm.version}</version>
			<scope>provided</scope>
		</dependency>

		<!-- POCKETKNIFE LOGGING -->

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

		<!-- Launch / Provisioning Tasks -->

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

		<!-- should be required by pocketknife! -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>

		<!-- ========================================================================== -->
		<!-- https://extranet.atlassian.com/display/FED/Async+Web+Resource+Loading+v0.1 -->
		<!-- ========================================================================== -->

		<dependency>
			<groupId>com.atlassian.plugins</groupId>
			<artifactId>atlassian-plugins-webresource-plugin</artifactId>
			<version>3.1.0</version>
			<scope>provided</scope>
		</dependency>

		<!-- ========================================================================================= -->
		<!-- https://developer.atlassian.com/display/DOCS/Run+Wired+Tests+with+the+Plugin+Test+Console -->
		<!-- ========================================================================================= -->

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

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

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>portfolio-environment-test-utils</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>portfolio-environment-test-utils-jira</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian</groupId>
			<artifactId>atlassian-test-categories</artifactId>
			<version>0.5</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
		</dependency>

		<dependency>
			<groupId>com.atlassian.functest</groupId>
			<artifactId>functest-plugin</artifactId>
			<version>${functest.plugin.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-client</artifactId>
			<version>1.19</version>
			<scope>provided</scope>
		</dependency>

	</dependencies>

	<build>

		<plugins>

			<plugin>

				<artifactId>maven-clean-plugin</artifactId>

				<configuration>
					<filesets combine.children="append">
						<fileset>
							<directory>src/main/resources</directory>
							<includes>
								<include>analytics/whitelist.json</include>
							</includes>
						</fileset>
					</filesets>
				</configuration>

			</plugin>

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

			<plugin>

				<groupId>com.atlassian.maven.plugins</groupId>
				<artifactId>amps-maven-plugin</artifactId>

				<configuration>

					<product>jira</product>
					<productVersion>${jira.it.version}</productVersion>

					<testGroups>
						<testGroup>
							<id>tg-jira-it</id>
							<productIds>
								<productId>jira</productId>
							</productIds>
							<includes>
								<include>${jira.it.test.pattern}</include>
							</includes>
						</testGroup>
					</testGroups>

					<!--
						reg. LauncherContextListener:
						https://answers.atlassian.com/questions/36119444/answers/36121004
						otherwise the wired integration tests are executed too early, at a point where the test-runner endpoints are not yet available.
					-->
					<jvmArgs>
						-Datlassian.plugins.enable.wait=300
						-Dcom.atlassian.jira.startup.LauncherContextListener.SYNCHRONOUS=true
						-Xmx2048m
						-Xms512m
					</jvmArgs>

				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>${jira.it.test.pattern}</exclude>
						<exclude>${jira.it.acceptance.test.pattern}</exclude>
					</excludes>
				</configuration>
			</plugin>

			<!-- configure spring scanner -->
			<plugin>

				<groupId>com.atlassian.plugin</groupId>
				<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
				<version>${atlassian.spring.scanner.version}</version>

				<executions>
					<execution>
						<goals>
							<goal>atlassian-spring-scanner</goal>
						</goals>
						<phase>process-classes</phase>
					</execution>
				</executions>

				<configuration>

					<scannedDependencies>

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

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

						<dependency>
							<groupId>com.atlassian.rm</groupId>
							<artifactId>portfolio-2-bridge-api</artifactId>
						</dependency>
						<dependency>
							<groupId>com.atlassian.rm</groupId>
							<artifactId>portfolio-2-bridge-0.0</artifactId>
						</dependency>

						<dependency>
							<groupId>com.atlassian.rm</groupId>
							<artifactId>portfolio-agile-api-api</artifactId>
						</dependency>
						<dependency>
							<groupId>com.atlassian.rm</groupId>
							<artifactId>portfolio-agile-api-impl</artifactId>
						</dependency>
<!--						<dependency>-->
<!--							<groupId>com.atlassian.rm</groupId>-->
<!--							<artifactId>portfolio-agile-api-8.6</artifactId>-->
<!--						</dependency>-->
						<dependency>
							<groupId>com.atlassian.rm</groupId>
							<artifactId>portfolio-agile-api-jpo</artifactId>
						</dependency>

						<dependency>
							<groupId>com.atlassian.rm</groupId>
							<artifactId>portfolio-bridges</artifactId>
						</dependency>

						<dependency>
							<groupId>com.atlassian.rm</groupId>
							<artifactId>portfolio-jira-bridge-api</artifactId>
						</dependency>
						<dependency>
							<groupId>com.atlassian.rm</groupId>
							<artifactId>portfolio-jira-bridge-impl</artifactId>
						</dependency>

					</scannedDependencies>

					<verbose>false</verbose>

				</configuration>

			</plugin>

		</plugins>

	</build>

	<profiles>

		<!-- jiraRenaissance compatible data for usage with mysql -->
		<profile>
			<id>mysqlRenaissanceData</id>
			<activation>
				<property><name>mysqlRenaissanceData</name></property>
				<activeByDefault>false</activeByDefault>
			</activation>
			<properties>
				<amps.resources.postgres>${project.parent.basedir}/../../../builds/jira-resources/jira-7-renaissance-mysql.zip</amps.resources.postgres>
				<docker.postgres.init.folder>${project.parent.basedir}/../../../builds/databases/mysql/init-renaissance:/docker-entrypoint-initdb.d</docker.postgres.init.folder>
			</properties>
		</profile>

		<profile>
			<id>mysql</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<property><name>mysql</name></property>
			</activation>

			<properties>
				<db.version>latest</db.version> <!-- may be overridden -->
			</properties>
			<dependencies>
				<dependency>
					<groupId>mysql</groupId>
					<artifactId>mysql-connector-java</artifactId>
					<version>5.1.39</version>
				</dependency>
			</dependencies>

			<build>
				<plugins>
					<plugin>
						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>amps-maven-plugin</artifactId>
						<configuration>
							<products>
								<product>
									<id>jira</id>
									<libArtifacts>
										<libArtifact>
											<groupId>mysql</groupId>
											<artifactId>mysql-connector-java</artifactId>
											<version>5.1.39</version>
										</libArtifact>
									</libArtifacts>
								</product>
							</products>
							<productDataPath>${amps.resources.mysql}</productDataPath>
						</configuration>
					</plugin>

					<!--
                        docker plugin to start and stop postgres docker container.
                        start with "mvn -Dpostgres docker:start"
                        stop with "mvn -Dpostgres docker:stop"
                    -->
					<plugin>
						<groupId>io.fabric8</groupId>
						<artifactId>docker-maven-plugin</artifactId>

						<configuration>
							<autoPull>always</autoPull>
							<removeVolumes>true</removeVolumes>
							<images>
								<image>
									<alias>mysql-db</alias>
									<name>${mysql.docker.repo}:${db.version}</name>
									<run>
										<env>
											<MYSQL_USER>jirauser</MYSQL_USER>
											<MYSQL_PASSWORD>jirauser</MYSQL_PASSWORD>
											<MYSQL_ROOT_PASSWORD>jirauser</MYSQL_ROOT_PASSWORD>
											<MYSQL_DATABASE>jiradb</MYSQL_DATABASE>
										</env>
										<ports>
											<port>13306:3306</port>
										</ports>
										<volumes>
											<bind>
												<volume>${docker.mysql.init.folder}</volume>
											</bind>
										</volumes>
										<wait>
											<log>MySQL init process done. Ready for start up|mysqld: ready for connections</log>
											<time>100000</time>
											<kill>5000</kill>
											<shutdown>2000</shutdown>
										</wait>
									</run>
								</image>
							</images>
						</configuration>

						<executions>
							<execution>
								<id>start</id>
								<phase>none</phase>
								<goals>
									<goal>start</goal>
								</goals>
							</execution>
							<execution>
								<id>stop</id>
								<phase>none</phase>
								<goals>
									<goal>stop</goal>
									<goal>remove</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

				</plugins>
			</build>

		</profile>

		<profile>
			<id>postgres</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<property><name>postgres</name></property>
			</activation>

			<dependencies>
				<dependency>
					<groupId>org.postgresql</groupId>
					<artifactId>postgresql</artifactId>
					<version>${postgres.jdbc.version}</version>
				</dependency>
			</dependencies>

			<build>
				<plugins>
					<plugin>
						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>amps-maven-plugin</artifactId>
						<configuration>
							<products>
								<product>
									<id>jira</id>
									<libArtifacts>
										<libArtifact>
											<groupId>org.postgresql</groupId>
											<artifactId>postgresql</artifactId>
											<version>${postgres.jdbc.version}</version>
										</libArtifact>
									</libArtifacts>
								</product>
							</products>
							<productDataPath>${amps.resources.postgres}</productDataPath>
						</configuration>
					</plugin>

					<!--
                        docker plugin to start and stop postgres docker container.
                        start with "mvn -Dpostgres docker:start"
                        stop with "mvn -Dpostgres docker:stop"
                    -->
					<plugin>
						<groupId>io.fabric8</groupId>
						<artifactId>docker-maven-plugin</artifactId>

						<configuration>
							<autoPull>always</autoPull>
							<removeVolumes>true</removeVolumes>
							<images>
								<image>
									<alias>postgres-db</alias>
									<name>postgres:${db.version}</name>
									<run>
										<env>
											<POSTGRES_USER>postgres</POSTGRES_USER>
											<POSTGRES_PASSWORD>postres</POSTGRES_PASSWORD>
											<POSTGRES_DB>postgres</POSTGRES_DB>
										</env>
										<ports>
											<port>15432:5432</port>
										</ports>
										<volumes>
											<bind>
												<volume>${docker.postgres.init.folder}</volume>
											</bind>
										</volumes>
										<wait>
											<log>PostgreSQL init process complete; ready for start up</log>
											<time>45000</time>
											<kill>5000</kill>
											<shutdown>2000</shutdown>
										</wait>
										<log>
											<enabled>true</enabled>
										</log>
									</run>
								</image>
							</images>
						</configuration>

						<executions>
							<execution>
								<id>start</id>
								<phase>none</phase>
								<goals>
									<goal>start</goal>
								</goals>
							</execution>
							<execution>
								<id>stop</id>
								<phase>none</phase>
								<goals>
									<goal>stop</goal>
									<goal>remove</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

				</plugins>
			</build>

		</profile>



		<!-- ######################

            profiles for execution of wired tests

            e.g.

            mvn -Pwiredtests exec:exec

            #######################
        -->

		<profile>
			<id>wiredtests</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<property><name>wiredtests</name></property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.5.0</version>
						<executions>
							<!-- Required: The following will ensure `npm install` is called
                                 before anything else during the 'Default Lifecycle' -->

							<execution>
								<id>wiredtests-run</id>
								<phase>none</phase>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>

						</executions>

						<configuration>
							<executable>npm</executable>
							<workingDirectory>${basedir}</workingDirectory>
							<arguments>
								<argument>run</argument>
								<argument>${wiredtests.script}</argument>
							</arguments>
						</configuration>

					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>wiredtests-postgres</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<property><name>wiredtestsPostgres</name></property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.5.0</version>
						<executions>
							<!-- Required: The following will ensure `npm install` is called
                                 before anything else during the 'Default Lifecycle' -->

							<execution>
								<id>wiredtests-run</id>
								<phase>none</phase>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>

						</executions>

						<configuration>
							<executable>npm</executable>
							<workingDirectory>${basedir}</workingDirectory>
							<arguments>
								<argument>run</argument>
								<argument>${wiredtests.script}</argument>
								<argument>--</argument>
								<argument>-p</argument>
								<argument>postgres</argument>
							</arguments>
						</configuration>

					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>

			<id>jira-test-data</id>
			<activation>
				<property><name>jiraTestData</name></property>
			</activation>

			<properties>
				<amps.resources>${amps.resources.testdata}</amps.resources>
			</properties>

		</profile>

		<profile>

			<id>jpo-2-and-tm</id>
			<activation>
				<property><name>!noClassicPortfolioDependencies</name></property>
			</activation>

			<build>

				<plugins>

					<plugin>

						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>amps-maven-plugin</artifactId>

						<configuration>

							<pluginArtifacts combine.children="append">

								<pluginArtifact>
									<groupId>com.atlassian</groupId>
									<artifactId>portfolio-plugin</artifactId>
									<version>${project.version}</version>
								</pluginArtifact>

								<pluginArtifact>
									<groupId>com.atlassian</groupId>
									<artifactId>team-management-plugin</artifactId>
									<version>${project.version}</version>
								</pluginArtifact>

							</pluginArtifacts>

						</configuration>

					</plugin>

				</plugins>

			</build>

		</profile>

		<profile>

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

			<build>

				<plugins>

					<plugin>

						<artifactId>maven-clean-plugin</artifactId>

						<configuration>
							<filesets combine.children="append">
								<fileset>
									<directory>src/main/resources</directory>
									<includes>
										<include>scripts/</include>
										<include>styles/</include>
										<include>styles-lib/</include>
										<include>images/</include>
										<include>views/</include>
										<include>fonts/</include>
									</includes>
								</fileset>
							</filesets>
						</configuration>

					</plugin>

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

							<execution>
								<id>yarn install</id>
								<goals>
									<goal>yarn</goal>
								</goals>
								<configuration>
									<arguments>install</arguments>
									<installDirectory>../../${node.installDirectory}</installDirectory>
								</configuration>
								<phase>initialize</phase>
								<inherited>false</inherited>
							</execution>



							<execution>
								<id>grunt-build</id>
								<goals>
									<goal>grunt</goal>
								</goals>

								<phase>generate-resources</phase>

								<configuration>
									<installDirectory>../../${node.installDirectory}</installDirectory>
								</configuration>
							</execution>

						</executions>
					</plugin>

					<!-- generate whitelist.json file -->
					<plugin>

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

						<executions>

							<execution>

								<id>generate-whitelist</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>exec</goal>
								</goals>

								<configuration>

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

									<arguments>
										<argument>${basedir}/utils/generate-whitelist.js</argument>
										<argument>${basedir}/src/main/resources/analytics/whitelist.js</argument>
										<argument>${basedir}/src/main/resources/analytics/whitelist.json</argument>
									</arguments>

								</configuration>

							</execution>

						</executions>

					</plugin>

				</plugins>

			</build>

		</profile>

		<profile>

			<id>jrebel</id>
			<activation>
				<property>
					<name>jrebel</name>
				</property>
			</activation>

			<build>
				<plugins>

					<plugin>
						<groupId>org.zeroturnaround</groupId>
						<artifactId>jrebel-maven-plugin</artifactId>
						<version>1.1.5</version>

						<configuration>
							<addResourcesDirToRebelXml>true</addResourcesDirToRebelXml>
							<alwaysGenerate>true</alwaysGenerate>
							<showGenerated>true</showGenerated>
							<packaging>jar</packaging>
							<classpath>
								<resources>
									<resource>
										<includes>
											<include>com/radiantminds/plugins/jira/**</include>
										</includes>
									</resource>
									<resource>
										<directory>../roadmap-common/target/classes</directory>
										<includes>
											<include>com/radiantminds/**</include>
										</includes>
									</resource>
									<resource>
										<directory>../roadmap-jira-common/target/classes</directory>
										<includes>
											<include>com/radiantminds/**</include>
										</includes>
									</resource>
									<resource>
										<directory>../../scheduling/target/classes</directory>
										<includes>
											<include>com/radiantminds/**</include>
										</includes>
									</resource>
									<resource>
										<directory>../../portfolio-bridges/target/classes</directory>
										<includes>
											<include>com/atlassian/rm/**</include>
										</includes>
									</resource>
									<resource>
										<directory>../../portfolio-jira-bridge/portfolio-jira-bridge-api/target/classes</directory>
										<includes>
											<include>com/atlassian/rm/**</include>
										</includes>
									</resource>
									<resource>
										<directory>../../portfolio-jira-bridge/portfolio-jira-bridge-impl/target/classes</directory>
										<includes>
											<include>com/atlassian/rm/**</include>
										</includes>
									</resource>
									<resource>
										<directory>../../portfolio-agile-api/portfolio-agile-api-api/target/classes</directory>
										<includes>
											<include>com/atlassian/rm/**</include>
										</includes>
									</resource>
									<resource>
										<directory>../../portfolio-agile-api/portfolio-agile-api-impl/target/classes</directory>
										<includes>
											<include>com/atlassian/rm/**</include>
										</includes>
									</resource>
<!--									<resource>-->
<!--										<directory>../../portfolio-agile-api/portfolio-agile-api-8.6/target/classes</directory>-->
<!--										<includes>-->
<!--											<include>com/atlassian/rm/**</include>-->
<!--										</includes>-->
<!--									</resource>-->
									<resource>
										<directory>../../portfolio-agile-api/portfolio-agile-api-jpo/target/classes</directory>
										<includes>
											<include>com/atlassian/rm/**</include>
										</includes>
									</resource>
								</resources>
							</classpath>
						</configuration>

						<executions>
							<execution>
								<id>generate-rebel-xml</id>
								<phase>process-resources</phase>
								<goals>
									<goal>generate</goal>
								</goals>

								<configuration>
									<classpath>
										<resources>

											<resource>
												<includes>
													<include>com/radiantminds/plugins/jira/**</include>
												</includes>
											</resource>

											<resource>
												<directory>../roadmap-common/target/classes</directory>
												<includes>
													<include>com/radiantminds/**</include>
												</includes>
											</resource>
											<resource>
												<directory>../roadmap-jira-common/target/classes</directory>
												<includes>
													<include>com/radiantminds/**</include>
												</includes>
											</resource>
											<resource>
												<directory>../scheduling/target/classes</directory>
												<includes>
													<include>com/radiantminds/**</include>
												</includes>
											</resource>
											<resource>
												<directory>../../portfolio-jira-bridge/portfolio-jira-bridge-api/target/classes</directory>
												<includes>
													<include>com/atlassian/rm/**</include>
												</includes>
											</resource>
											<resource>
												<directory>../../portfolio-jira-bridge/portfolio-jira-bridge-impl/target/classes</directory>
												<includes>
													<include>com/atlassian/rm/**</include>
												</includes>
											</resource>
											<resource>
												<directory>../../portfolio-agile-api/portfolio-agile-api-api/target/classes</directory>
												<includes>
													<include>com/atlassian/rm/**</include>
												</includes>
											</resource>
											<resource>
												<directory>../../portfolio-agile-api/portfolio-agile-api-impl/target/classes</directory>
												<includes>
													<include>com/atlassian/rm/**</include>
												</includes>
											</resource>
<!--											<resource>-->
<!--												<directory>../../portfolio-agile-api/portfolio-agile-api-8.6/target/classes</directory>-->
<!--												<includes>-->
<!--													<include>com/atlassian/rm/**</include>-->
<!--												</includes>-->
<!--											</resource>-->
											<resource>
												<directory>../../portfolio-agile-api/portfolio-agile-api-jpo/target/classes</directory>
												<includes>
													<include>com/atlassian/rm/**</include>
												</includes>
											</resource>


										</resources>
									</classpath>
								</configuration>

							</execution>

							<execution>
								<id>generate-rebel-xml-tests</id>
								<phase>generate-test-resources</phase>
								<goals>
									<goal>generate</goal>
								</goals>

								<configuration>

									<rebelXmlDirectory>${project.build.testOutputDirectory}</rebelXmlDirectory>
									<classpath>
										<resources>

											<resource>
												<excludes>
													<exclude>com/radiantminds/roadmap/common/**</exclude>
												</excludes>
											</resource>

											<resource>

												<directory>${project.build.testOutputDirectory}</directory>
												<includes>
													<include>it/**</include>
													<include>com/radiantminds/plugins/jira/**</include>
												</includes>
												<excludes>
													<exclude>com/radiantminds/roadmap/common/**</exclude>
												</excludes>
											</resource>

										</resources>
									</classpath>

								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>

						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>amps-maven-plugin</artifactId>

						<configuration>
							<jvmArgs>-javaagent:${basedir}/../../devutils/jrebel.jar -Drebel.spring_plugin=true</jvmArgs>
						</configuration>

					</plugin>

				</plugins>
			</build>
		</profile>

		<profile>

			<id>license-resources</id>

			<activation>
				<property>
					<name>!skipLicenses</name>
				</property>
			</activation>

			<build>

				<plugins>

					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>license-maven-plugin</artifactId>
						<version>1.7</version>

						<executions>

							<execution>
								<id>generate-bom</id>
								<phase>generate-resources</phase>

								<configuration>
									<!-- paths from point of view of parent pom -->
									<fileTemplate>${basedir}/third-party-file.ftl</fileTemplate>
									<outputDirectory>${basedir}/target/license-resources/</outputDirectory>
									<excludedScopes>test</excludedScopes>
									<thirdPartyFilename>bom.csv</thirdPartyFilename>
								</configuration>

								<goals>
									<goal>add-third-party</goal>
								</goals>
							</execution>

							<execution>
								<id>generate-index</id>
								<phase>generate-resources</phase>

								<configuration>
									<fileTemplate>${basedir}/license-index.ftl</fileTemplate>
									<outputDirectory>${basedir}/target/license-resources/licenses</outputDirectory>
									<excludedScopes>test</excludedScopes>
									<thirdPartyFilename>index.txt</thirdPartyFilename>
								</configuration>

								<goals>
									<goal>add-third-party</goal>
								</goals>
							</execution>

							<execution>
								<id>license-list</id>
								<phase>generate-resources</phase>

								<configuration>
									<excludedScopes>test</excludedScopes>
									<licensesOutputDirectory>${basedir}/target/license-resources/licenses/details</licensesOutputDirectory>
								</configuration>

								<goals>
									<goal>download-licenses</goal>
								</goals>
							</execution>

						</executions>
					</plugin>

				</plugins>

			</build>


		</profile>

		<profile>
			<id>create-atlassian-plugin</id>

			<activation>
				<property>
					<name>!skipPackaging</name>
				</property>
			</activation>

			<properties>
				<packaging.type>atlassian-plugin</packaging.type>
			</properties>

			<build>

				<resources>

					<resource>
						<directory>${basedir}/target/license-resources</directory>
						<targetPath>.</targetPath>
						<includes>
							<include>*.csv</include>
						</includes>
					</resource>
					<resource>
						<directory>${basedir}/target/license-resources/licenses</directory>
						<targetPath>./licenses</targetPath>
						<includes>
							<include>index.txt</include>
							<include>details/*.*</include>
						</includes>
					</resource>
					<resource>
						<directory>${basedir}/src/main/resources</directory>
					</resource>
				</resources>

				<plugins>

					<plugin>

						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>amps-maven-plugin</artifactId>

						<configuration>

							<compressResources>false</compressResources>

							<enableFastdev>${enableFastdev}</enableFastdev>

							<buildTestPlugin>true</buildTestPlugin>

							<testInstructions>

								<!-- force osgi to search for stuff we have explicitly excluded via testBundleExcludes -->
								<!-- this is slow (apparently), but used only in the test bundle, so no production code affected -->
								<DynamicImport-Package>*</DynamicImport-Package>

								<!-- we need to specify at least one, or an amps bug will screw up our manifest -->
								<Export-Package>
									com.radiantminds.plugins.jira.utils.*
								</Export-Package>

							</testInstructions>

							<instructions>

								<!--
									NOTE: this MUST, MUST, MUST be the plugin ID due to a bug/fug somewhere down the
									road through manifest generation (the group/artifact id is used as a default
									symbolic bundle name, but if and only if 'instructions' are passed, otherwise
									the plugin id is used) and active objects (which uses the symbolic bundle name
									rather than the plugin id to generate prefixes.
								-->
								<Bundle-SymbolicName>com.radiantminds.roadmaps-jira</Bundle-SymbolicName>

								<DynamicImport-Package>
									${agile.bridge.dynamic.imports}
									com.atlassian.rm.jpo.api.common;resolution:=optional,
									com.atlassian.rm.jpo.api.plans;resolution:=optional
								</DynamicImport-Package>

								<Import-Package>
									com.querydsl.sql,
									*;resolution:=optional
								</Import-Package>

								<Export-Package>
									com.radiantminds.roadmap.api.*,
                                    com.radiantminds.roadmaps-jira.obr.install,
									!*
								</Export-Package>

							</instructions>

						</configuration>

					</plugin>

				</plugins>

			</build>
		</profile>

        <!-- Profile for packaging obr -->

        <profile>
            <id>portfolio-2-obr</id>

            <activation>
                <property>
                    <name>!skipPortfolio2</name>
                </property>
            </activation>

            <!-- Libraries/plugins to add to OBR -->
            <dependencies>
                <dependency>
                    <groupId>com.atlassian</groupId>
                    <artifactId>portfolio-plugin</artifactId>
                    <version>${project.version}</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.atlassian</groupId>
                    <artifactId>team-management-plugin</artifactId>
                    <version>${project.version}</version>
                    <scope>provided</scope>
                </dependency>

				<dependency>

					<groupId>com.atlassian.querydsl.plugins</groupId>
					<artifactId>querydsl-${querydsl.version}-provider-plugin</artifactId>
					<version>${querydsl.provider.version}</version>
					<scope>provided</scope>

					<!--
						exclude to prevent versioning madness; for reasons HO doesn't fully understand,
						maven tries to pull in querydsl-sql 3.5.0 (which doesn't exist) as a transitive dependency
					-->
					<exclusions>

						<exclusion>
							<groupId>com.querydsl</groupId>
							<artifactId>querydsl-sql</artifactId>
						</exclusion>
						<exclusion>
							<groupId>com.google.guava</groupId>
							<artifactId>guava</artifactId>
						</exclusion>

					</exclusions>

				</dependency>

            </dependencies>

            <build>
                <plugins>

                    <plugin>

                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>amps-maven-plugin</artifactId>

                        <configuration>
							<skipBanningDependencies>true</skipBanningDependencies>

                            <!-- OBR Building -->
                            <!-- Specify what to bundle in the OBR -->
                            <pluginDependencies>
                                <pluginDependency>
                                    <groupId>com.atlassian</groupId>
                                    <artifactId>portfolio-plugin</artifactId>
                                </pluginDependency>
                                <pluginDependency>
                                    <groupId>com.atlassian</groupId>
                                    <artifactId>team-management-plugin</artifactId>
                                </pluginDependency>

								<pluginDependency>
									<groupId>com.atlassian.querydsl.plugins</groupId>
									<artifactId>querydsl-${querydsl.version}-provider-plugin</artifactId>
								</pluginDependency>

                            </pluginDependencies>

                        </configuration>

                    </plugin>

                </plugins>
            </build>
        </profile>

		<profile>

			<id>clean-node-modules</id>
			<activation>
				<property>
					<name>cleanNodeModules</name>
				</property>
			</activation>

			<build>

				<plugins>

					<plugin>

						<artifactId>maven-clean-plugin</artifactId>

						<configuration>
							<filesets>
								<fileset>
									<directory>${basedir}</directory>
									<includes>
										<include>node_modules/</include>
									</includes>
								</fileset>
							</filesets>
						</configuration>

					</plugin>

				</plugins>

			</build>

		</profile>

	</profiles>

</project>
