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

	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.atlassian.rm</groupId>
		<artifactId>common-plugin-parent-pom</artifactId>
		<version>1001.5.0-D20170327T061117</version>
		<relativePath>../../common/common-plugin-parent-pom/pom.xml</relativePath>
	</parent>

    <groupId>com.atlassian</groupId>
	<artifactId>team-management-plugin</artifactId>

	<name>Portfolio 2 / Team Management [Plugin]</name>

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

	<properties>

        <!-- OD Testing configuration -->
        <od.testing.configuration>
            use-maven,3
            include-artifact,com.atlassian.rm:common-atsslats
        </od.testing.configuration>

	</properties>

	<dependencies>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>common-core</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>common-plugin-standard-dependencies</artifactId>
			<version>${project.version}</version>
			<type>pom</type>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>common-plugin</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>common-client</artifactId>
			<version>${project.version}</version>
			<type>pom</type>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>team-management-client</artifactId>
			<version>${project.version}</version>
			<type>pom</type>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>team-management-core</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>team-management-rest</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>team-management-environment-api</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>team-management-environment-jira</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>team-management-customfields-api</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>team-management-customfields-cloud</artifactId>
			<version>${project.version}</version>
		</dependency>

		<!-- dependency needed for maven bundle plugin -> for embedding it as an inline dependency -->
		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>common-rest</artifactId>
			<version>${project.version}</version>
		</dependency>

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

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

		<dependency>
			<groupId>com.atlassian.plugin</groupId>
			<artifactId>atlassian-spring-scanner-runtime</artifactId>
		</dependency>

		<dependency>
			<groupId>com.atlassian.plugins.rest</groupId>
			<artifactId>atlassian-rest-common</artifactId>
			<version>2.9.13</version>
			<scope>provided</scope>
		</dependency>

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

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

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

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

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

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
			<scope>provided</scope>
		</dependency>

		<!-- sal -->

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

		<!-- test -->

		<dependency>
			<groupId>org.reflections</groupId>
			<artifactId>reflections</artifactId>
			<scope>test</scope>
		</dependency>

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

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

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>common-plugin</artifactId>
			<version>${project.version}</version>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.rm</groupId>
			<artifactId>common-rest</artifactId>
			<version>${project.version}</version>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.functest</groupId>
			<artifactId>functest-plugin</artifactId>
			<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>

			<!-- amps plugin; for config see parent pom -->
			<plugin>

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

				<configuration>

					<systemPropertyVariables>
						<atlassian.darkfeature.com.atlassian.rm.teams.menu.MainMenuEntry>true</atlassian.darkfeature.com.atlassian.rm.teams.menu.MainMenuEntry>
						<atlassian.darkfeature.com.atlassian.portfolio.skills.StagesAndSkills>true</atlassian.darkfeature.com.atlassian.portfolio.skills.StagesAndSkills>
						<!--Enable for Vertigo upgrade task framework-->
                        <!--<atlassian.darkfeature.com.atlassian.jira.cloud.upgrade.task.framework.enabled>true</atlassian.darkfeature.com.atlassian.jira.cloud.upgrade.task.framework.enabled>-->
                        <!--<atlassian.darkfeature.com.atlassian.rm.portfolio.vertigo.Upgrading>true</atlassian.darkfeature.com.atlassian.rm.portfolio.vertigo.Upgrading>-->
                        <!--<atlassian.darkfeature.com.atlassian.rm.portfolio.vertigo.Provisioning>true</atlassian.darkfeature.com.atlassian.rm.portfolio.vertigo.Provisioning>-->
                    </systemPropertyVariables>

					<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.atlassian.teams</Bundle-SymbolicName>
						<DynamicImport-Package>
							${agile.bridge.dynamic.imports}
						</DynamicImport-Package>
						<Export-Package>
							com.atlassian.rm.teams.api.ability.*,
							com.atlassian.rm.teams.api.team.*,
							com.atlassian.rm.teams.api.resource.*,
							com.atlassian.rm.teams.api.person.*,
							com.atlassian.rm.teams.api.skill.*,
							com.atlassian.rm.teams.api.common.*,
							com.atlassian.rm.teams.plugin.views.manage.view.*,
							!*
						</Export-Package>

					</instructions>

				</configuration>

			</plugin>

			<!-- spring scanner; for config see parent pom -->
			<plugin>
				<groupId>com.atlassian.plugin</groupId>
				<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
			</plugin>

			<!-- for config of surefire see parent pom -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
			</plugin>

		</plugins>

	</build>

	<profiles>

		<!-- build with amps -->
		<profile>
			<id>build-with-amps-plugin</id>

			<activation>
				<property>
					<name>!kickAmps</name>
				</property>
			</activation>

			<build>

				<testResources>
					<testResource>
						<directory>src/test/resources</directory>
						<filtering>true</filtering>
						<excludes>
							<exclude>META-INF/spring/team-management-test-context.xml</exclude>
						</excludes>

					</testResource>
				</testResources>

				<plugins>

					<!-- add test sources for wired integration tests -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<version>1.9.1</version>
						<executions>
							<execution>
								<id>add-test-source</id>
								<phase>generate-test-sources</phase>
								<goals>
									<goal>add-test-source</goal>
								</goals>
								<configuration>
									<sources combine.children="append">

										<!--

											don't include ALL plugin components as views conflict in weird and potentially
											jira-buggy ways when provided by both the main and the test plugin

										-->

										<source>src/main/java/com/atlassian/rm/common/plugin/lifecycle</source>

										<!-- spis -->

										<source>src/main/java/com/atlassian/rm/teams/plugin/ao</source>
										<source>src/main/java/com/atlassian/rm/teams/plugin/pocketknife</source>
										<source>src/main/java/com/atlassian/rm/teams/plugin/views/common/data/features</source>

										<!-- wits -->

										<!-- maven sucks and does not support wildcards here -->

										<source>${wired.test.directory}</source>

										<source>../team-management-core/${wired.test.directory}</source>
										<source>../team-management-environment/team-management-environment-jira/${wired.test.directory}</source>

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

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

		<!-- build with bundle plugin -->
		<profile>
			<id>build-with-bundle-plugin</id>

			<activation>
				<property>
					<name>kickAmps</name>
				</property>
			</activation>

			<build>

				<testResources>
					<testResource>
						<directory>src/test/resources</directory>
						<filtering>true</filtering>
						<excludes>
							<exclude>META-INF/spring/team-management-test-context-amps.xml</exclude>
							<exclude>atlassian-plugin.xml</exclude>
						</excludes>
					</testResource>
				</testResources>

				<plugins>

					<!-- add test sources for wired integration tests -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<version>1.9.1</version>
						<executions>
							<execution>
								<id>add-test-source</id>
								<phase>generate-test-sources</phase>
								<goals>
									<goal>add-test-source</goal>
								</goals>
								<configuration>
									<sources combine.children="append">

										<source>${wired.test.directory}</source>

										<source>../team-management-core/${wired.test.directory}</source>
										<source>../team-management-environment/team-management-environment-jira/${wired.test.directory}</source>

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

					<plugin>

						<groupId>org.apache.felix</groupId>
						<artifactId>maven-bundle-plugin</artifactId>

						<configuration>

							<instructions>

								<Embed-Dependency>
									*;scope=compile|runtime,
									*;artifactId=common-rest;type=jar;inline=true,
									*;artifactId=team-management-rest;type=jar;inline=true,
								</Embed-Dependency>

								<!--
									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.atlassian.teams</Bundle-SymbolicName>

								<DynamicImport-Package>
									${agile.bridge.dynamic.imports}
								</DynamicImport-Package>

								<Import-Package>
									*;resolution:=optional
								</Import-Package>

								<_exportcontents>
									com.atlassian.rm.teams.api.*,
									com.atlassian.rm.teams.plugin.views.manage.view.*,
									!*
								</_exportcontents>

								<Require-Capability>osgi.ee;filter:="(&amp;(osgi.ee=JavaSE)(version=1.7))"</Require-Capability>

								<Spring-Context>*</Spring-Context>

							</instructions>
						</configuration>
					</plugin>

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

		<!--
					To be used in combination with the 'build-with-bundle-plugin' profile.
					Includes all wired test classes / and needed configuration in the packaged plugin
				-->
		<profile>
			<id>test-plugin</id>

			<activation>
				<property>
					<name>testPlugin</name>
				</property>
			</activation>

			<build>

				<resources>

					<resource>
						<directory>src/test-wired/resources</directory>
						<filtering>true</filtering>
						<includes>
							<include>plugin-descriptors/atlassian-plugin-testgroups.xml</include>
						</includes>
					</resource>

				</resources>

				<plugins>

					<plugin>

						<groupId>org.apache.felix</groupId>
						<artifactId>maven-bundle-plugin</artifactId>

						<configuration>

							<instructions>

								<Embed-Dependency>
									*;scope=compile|runtime,
									*;artifactId=common-rest;type=jar;inline=true,
									*;artifactId=team-management-rest;type=jar;inline=true,
									*;scope=test;inline=false;groupId=com.atlassian.rm
								</Embed-Dependency>

								<Include-Resource>
									target/classes,
									target/test-classes,
									{maven-resources}
								</Include-Resource>

								<DynamicImport-Package>
									${agile.bridge.dynamic.imports}
								</DynamicImport-Package>

								<Import-Package>
									*;resolution:=optional
								</Import-Package>

								<_exportcontents>
									com.atlassian.rm.teams.api.*,
									com.atlassian.rm.teams.plugin.views.manage.view.*,
									!*
								</_exportcontents>

								<Require-Capability>osgi.ee;filter:="(&amp;(osgi.ee=JavaSE)(version=1.7))"</Require-Capability>

								<Spring-Context>*</Spring-Context>

							</instructions>
						</configuration>
					</plugin>

					<plugin>
						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>maven-amps-plugin</artifactId>
						<configuration>
							<skipTests>false</skipTests>
							<pluginArtifacts combine.children="append">

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

							</pluginArtifacts>
						</configuration>
					</plugin>

				</plugins>

			</build>

		</profile>

		<profile>

			<id>vertigo</id>

			<activation>
				<property>
					<name>vertigo</name>
				</property>
			</activation>

			<build>

				<plugins>

					<plugin>

						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>maven-amps-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>roadmaps-plugin</artifactId>
									<version>${project.version}</version>
								</pluginArtifact>

							</pluginArtifacts>

						</configuration>

					</plugin>

				</plugins>

			</build>

			<dependencies>

				<dependency>
					<groupId>com.atlassian.rm</groupId>
					<artifactId>team-management-customfields-vertigo</artifactId>
					<version>${project.version}</version>
				</dependency>

			</dependencies>

		</profile>

		<profile>

			<id>non-vertigo</id>

			<activation>
				<property>
					<name>!vertigo</name>
				</property>
			</activation>

			<dependencies>

				<dependency>
					<groupId>com.atlassian.rm</groupId>
					<artifactId>team-management-customfields-lucene</artifactId>
					<version>${project.version}</version>
				</dependency>

			</dependencies>
		</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-1-and-jpo-2</id>
			<activation>
				<property><name>!noClassicPortfolioDependencies</name></property>
			</activation>

			<build>

				<plugins>

					<plugin>

						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>maven-amps-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>jira-portfolio</artifactId>
									<version>${portfolio.1.version}</version>
								</pluginArtifact>

							</pluginArtifacts>

						</configuration>

					</plugin>

				</plugins>

			</build>

		</profile>

		<!-- client 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>teams/</include>
										<include>i18n-common/</include>
										<include>i18n-team-management-common/</include>
										<include>views/</include>
									</includes>
								</fileset>
							</filesets>
						</configuration>

					</plugin>

					<plugin>

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

						<executions>

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

									<executable>${path.to.common.client}/${node.modules.bin}/${grunt.executable}</executable>

									<arguments>
										<argument>--base</argument>
										<argument>${path.to.common.client}</argument>
									</arguments>

									<environmentVariables>
										<PATH>${basedir}/${path.to.node.folder}${path.separator}${env.PATH}</PATH>
									</environmentVariables>

								</configuration>
							</execution>

						</executions>

					</plugin>

				</plugins>

			</build>

		</profile>

		<profile>

			<id>clover</id>
			<activation>
				<property>
					<name>coverage</name>
				</property>
			</activation>

			<build>

				<plugins>

					<plugin>

						<!-- see parent pom for details -->
						<!-- must be present on plugin level, can be at 0%; -->
						<!-- otherwise, gsonentitytests run into weird classloader issues -->
						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>maven-clover2-plugin</artifactId>

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

		<!--
			skip surefire in integration test profile, cause it breaks on this module
			there should never be any db integration tests in the plugin module anyway
		 -->
		<profile>
			<id>integration-test</id>
			<activation>
				<property>
					<name>integration-test</name>
				</property>
			</activation>

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

		<!-- see parent definition for details -->
		<profile>
			<id>volt-integration-test</id>
			<activation>
				<property>
					<name>volt-it</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-dependency-plugin</artifactId>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>com.atlassian.functest</groupId>
									<artifactId>functest-plugin</artifactId>
									<version>${functest.plugin.version}</version>
								</artifactItem>
								<artifactItem>
									<groupId>com.atlassian.</groupId>
									<artifactId>roadmaps-plugin</artifactId>
									<version>${project.version}</version>
								</artifactItem>
								<artifactItem>
									<groupId>com.atlassian</groupId>
									<artifactId>portfolio-plugin</artifactId>
									<version>${project.version}</version>
								</artifactItem>
							</artifactItems>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

	</profiles>

</project>