<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>
    <artifactId>webswing-server-frontend</artifactId>&#xD;
    <version>20.2.5</version>
    <packaging>pom</packaging>
    <parent>
        <artifactId>webswing-server</artifactId>
        <groupId>org.webswing</groupId>
        <version>20.2.5</version>
        <relativePath>..</relativePath>
    </parent>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-resources</id>
						<phase>validate</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.basedir}/target/webswing-server-frontend</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/webapp</directory>
									<filtering>false</filtering>
									<excludes>
										<exclude>javascript/</exclude>
										<exclude>css/</exclude>
									</excludes>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>npm install</id>
                        <phase>package</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install --unsafe-perm=true --allow-root</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm build</id>
                        <phase>package</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm license report</id>
                        <phase>package</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run license-report</arguments>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <installDirectory>${project.basedir}/../..</installDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <!-- =========================================DEVELOPMENT JETTY RUN PROFILE=========================== -->
        <profile>
            <id>dev</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>npm install</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- =========================================RELEASE BUILD PROFILE================================== -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>npm build</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <configuration>
                                    <arguments>run build-prod</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
