<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>fish.focus.maven</groupId>
		<artifactId>focus-pom</artifactId>
		<version>2.5</version>
		<relativePath />
	</parent>
	<groupId>fish.focus.uvms</groupId>
	<artifactId>vms-web</artifactId>
	<version>1.1.36</version>
	<name>vms-web</name>
	<packaging>war</packaging>

	<properties>
		<scm.connection>scm:git:https://github.com/FocusFish/VMS-Frontend.git</scm.connection>
	</properties>

	<build>
		<finalName>${project.name}</finalName>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>com.github.eirslett</groupId>
					<artifactId>frontend-maven-plugin</artifactId>
					<version>1.7.5</version>
					<configuration>
						<nodeVersion>v14.17.0</nodeVersion>
						<npmVersion>6.14.13</npmVersion>
						<workingDirectory>${basedir}/app</workingDirectory>
						<installDirectory>${basedir}</installDirectory>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<configuration>
					<workingDirectory>${basedir}</workingDirectory>
					<completionGoals>clean verify scm:checkin</completionGoals>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-scm-plugin</artifactId>
				<version>1.11.2</version>
				<configuration>
					<message>[maven-scm-plugin] update package.json version</message>
					<includes>app/package.json</includes>
				</configuration>
			</plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>copy-environment-file</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/app/src/environments</outputDirectory>
              <resources>
                <resource>
                  <directory>webContent</directory>
                  <include>*.ts</include>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
			<plugin>
				<groupId>com.github.eirslett</groupId>
				<artifactId>frontend-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>install node and npm</id>
						<goals>
							<goal>install-node-and-npm</goal>
						</goals>
					</execution>
					<execution>
						<id>npm install</id>
						<goals>
							<goal>npm</goal>
						</goals>
						<configuration>
							<arguments>install</arguments>
						</configuration>
					</execution>
					<execution>
						<id>npm sync version</id>
						<goals>
							<goal>npm</goal>
						</goals>
						<configuration>
							<arguments>version ${project.artifact.selectedVersion.majorVersion}.${project.artifact.selectedVersion.minorVersion}.${project.artifact.selectedVersion.incrementalVersion} --allow-same-version</arguments>
						</configuration>
					</execution>
					<execution>
						<id>npm test</id>
						<goals>
							<goal>npm</goal>
						</goals>
						<configuration>
							<skip>${skipTests}</skip>
							<arguments>test -- --watch=false</arguments>
						</configuration>
					</execution>
					<execution>
						<id>npm run build</id>
						<goals>
							<goal>npm</goal>
						</goals>
						<configuration>
							<arguments>run build</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
					<warName>${project.artifactId}</warName>
					<webResources>
						<resource>
							<directory>${basedir}/app/dist/en</directory>
						</resource>
						<resource>
							<directory>${basedir}/app/dist/sv</directory>
							<targetPath>sv</targetPath>
						</resource>
						<resource>
							<directory>${basedir}/webContent</directory>
							<include>**/*.xml</include>
							<include>**/*.conf</include>
							<filtering>true</filtering>
						</resource>
					</webResources>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<scm>
		<connection>${scm.connection}</connection>
        <developerConnection>${scm.connection}</developerConnection>
		<tag>vms-web-0.27.5</tag>
	</scm>

</project>
