<?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>10.5.1</version>
		<relativePath>../pom.xml</relativePath>
	</parent>


	<groupId>com.atlassian</groupId>
	<artifactId>jira-portfolio</artifactId>
	<modelVersion>4.0.0</modelVersion>
	<packaging>atlassian-plugin</packaging>

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

	<properties>

		<maven.resources.overwrite>true</maven.resources.overwrite>

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

		<amps.resources>${basedir}/../../builds/jira-resources/${arj.base.amps.jira.home.resource.name}</amps.resources>

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

		<maven.build.cache.exclude.roadmapPluginNodeModules>${project.basedir}/node_modules</maven.build.cache.exclude.roadmapPluginNodeModules>
	</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>
			<scope>provided</scope>
		</dependency>

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

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

		<dependency>
			<groupId>jakarta.servlet</groupId>
			<artifactId>jakarta.servlet-api</artifactId>
			<scope>provided</scope>
		</dependency>

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

		<!-- Licensing -->

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

		<!-- 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>
			<scope>provided</scope>
		</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>
			<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>
			<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>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>
			<scope>test</scope>
		</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>com.atlassian.plugin</groupId>
			<artifactId>atlassian-spring-scanner-annotation</artifactId>
			<scope>provided</scope>
		</dependency>

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

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

		<dependency>
			<groupId>com.atlassian</groupId>
			<artifactId>team-management-plugin</artifactId>
			<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>
				<groupId>com.atlassian.maven.plugins</groupId>
				<artifactId>jira-maven-plugin</artifactId>

				<configuration>
					<productVersion>${jira.it.version}</productVersion>
					<skipBanningDependencies>true</skipBanningDependencies>
					<compressResources>false</compressResources>
					<buildTestPlugin>true</buildTestPlugin>

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

					<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,
							javax.inject,
							*;resolution:=optional
						</Import-Package>

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

					<!--
						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>
						${jvmOpens}
						${jacocoArgLine}
						-Datlassian.plugins.enable.wait=300
						-Dcom.atlassian.jira.startup.LauncherContextListener.SYNCHRONOUS=true
						-Xmx2048m
						-Xms512m
					</jvmArgs>

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

					<!-- 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>
					</pluginDependencies>
				</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-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>

		<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>
	</build>

	<profiles>
		<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>com.mysql</groupId>
					<artifactId>mysql-connector-j</artifactId>
					<version>${mysql.jdbc.version}</version>
				</dependency>
			</dependencies>

			<build>
				<plugins>
					<plugin>
						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>jira-maven-plugin</artifactId>
						<configuration>
							<libArtifacts>
								<libArtifact>
									<groupId>com.mysql</groupId>
									<artifactId>mysql-connector-j</artifactId>
									<version>${mysql.jdbc.version}</version>
								</libArtifact>
							</libArtifacts>
							<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>jira-maven-plugin</artifactId>
						<configuration>
							<libArtifacts>
								<libArtifact>
									<groupId>org.postgresql</groupId>
									<artifactId>postgresql</artifactId>
									<version>${postgres.jdbc.version}</version>
								</libArtifact>
							</libArtifacts>
							<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>

		<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>
								</configuration>
								<phase>initialize</phase>
								<inherited>false</inherited>
							</execution>

							<execution>
								<id>grunt-build</id>
								<goals>
									<goal>grunt</goal>
								</goals>
								<phase>generate-resources</phase>
							</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>

					<plugin>
						<groupId>com.atlassian.maven.plugins</groupId>
						<artifactId>jira-maven-plugin</artifactId>
						<executions>
							<execution>
								<inherited>false</inherited>
								<id>copy-fe-module-manifests</id>
								<phase>compile</phase>
								<goals>
									<goal>copy-fe-module-manifests</goal>
								</goals>
								<configuration>
									<includedFeModuleManifests>
										<includedFeModuleManifest>${project.basedir}/../package.json</includedFeModuleManifest>
										<includedFeModuleManifest>${project.basedir}/../yarn.lock</includedFeModuleManifest>
										<includedFeModuleManifest>${project.basedir}/../roadmap-common/package.json</includedFeModuleManifest>
										<includedFeModuleManifest>${project.basedir}/../roadmap-common/yarn.lock</includedFeModuleManifest>
										<includedFeModuleManifest>${project.basedir}/../roadmap-jira-plugin/package.json</includedFeModuleManifest>
										<includedFeModuleManifest>${project.basedir}/../roadmap-jira-plugin/yarn.lock</includedFeModuleManifest>
										<includedFeModuleManifest>${project.basedir}/../portfolio-1-unmanaged-manifest/package.json</includedFeModuleManifest>
										<includedFeModuleManifest>${project.basedir}/../portfolio-1-unmanaged-manifest/yarn.lock</includedFeModuleManifest>
									</includedFeModuleManifests>
								</configuration>
							</execution>
							<execution>
								<inherited>false</inherited>
								<id>js-enforcement</id>
								<goals>
									<goal>verify-fe-manifest-associations</goal>
								</goals>
								<configuration>
									<verifyFeManifestAssociationsInputEntrypoint>
										${project.build.directory}/${project.build.finalName}.jar
									</verifyFeManifestAssociationsInputEntrypoint>
									<verifyFeManifestAssociationsFailOnUndeclaredFiles>false</verifyFeManifestAssociationsFailOnUndeclaredFiles>
									<verifyFeManifestAssociationsFailOnExtraDeclarations>false</verifyFeManifestAssociationsFailOnExtraDeclarations>
								</configuration>
								<phase>verify</phase>
							</execution>
						</executions>
					</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>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>
