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

	<parent>
		<groupId>com.atlassian.rm</groupId>
		<artifactId>common</artifactId>
		<version>9.17.2</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<artifactId>common-plugin</artifactId>

	<name>Portfolio 2 / Common [Plugin]</name>

	<properties>
		<webpack.config>webpack-conf/prod/webpack.config.js</webpack.config>
		<maven.build.cache.exclude.commonPluginNodeModules>${project.basedir}/nodeModules</maven.build.cache.exclude.commonPluginNodeModules>
	</properties>

	<build>

		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>

				<executions>
					<execution>
						<goals>
							<goal>test-jar</goal>
						</goals>
                        <configuration>
                            <skip>false</skip>
                            <forceCreation>true</forceCreation>
                        </configuration>
					</execution>
				</executions>
			</plugin>

		</plugins>

	</build>

	<profiles>
		<!-- client build profile -->
		<profile>

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

			<dependencies>
				<!-- add for npm dependencies -->
				<dependency>
					<groupId>com.atlassian.rm</groupId>
					<artifactId>common-frontend-configuration</artifactId>
					<version>${project.version}</version>
					<type>pom</type>
				</dependency>

				<dependency>
					<groupId>com.atlassian.rm</groupId>
					<artifactId>common-client</artifactId>
					<type>pom</type>
				</dependency>
			</dependencies>

			<build>
				<plugins>
					<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  --frozen-lockfile --prefer-offline --mutex network --no-progress</arguments>
								</configuration>
								<phase>initialize</phase>
								<inherited>false</inherited>
							</execution>
							<execution>
								<id>webpack-build</id>
								<goals>
									<goal>webpack</goal>
								</goals>

								<phase>process-resources</phase>

								<configuration>
									<arguments>-p --config ${webpack.config}</arguments>
								</configuration>
							</execution>
						</executions>
					</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>

	<dependencies>

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

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

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

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

		<!-- active objects -->

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

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

		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>jira-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.upm</groupId>
			<artifactId>licensing-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.upm</groupId>
			<artifactId>upm-api</artifactId>
			<scope>provided</scope>
		</dependency>

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

		<dependency>
			<groupId>com.atlassian.plugin</groupId>
			<artifactId>atlassian-spring-scanner-annotation</artifactId>
			<scope>provided</scope>
		</dependency>

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

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

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

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

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

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

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

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

		<!-- Without this, unit tests fail because the OSGi Version class cannot be found -->
		<!-- See tech debit issue JPO-5620 -->
		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>jira-core</artifactId>
			<scope>provided</scope>
		</dependency>

	</dependencies>
</project>
