<?xml version="1.0" encoding="UTF-8"?>
<!--

    slizaa-web - Slizaa Static Software Analysis Tools
    Copyright © 2019 Code-Kontor GmbH and others (slizaa@codekontor.io)

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

-->
<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>io.codekontor.slizaa</groupId>
		<artifactId>slizaa-server-parent</artifactId>
		<version>1.0.0.M3</version>
		<relativePath>../slizaa-poms/slizaa-server-parent/pom.xml</relativePath>
	</parent>

	<artifactId>slizaa-web</artifactId>

	<properties>
		<frontend-maven-plugin.version>1.6</frontend-maven-plugin.version>
		<node.version>v10.13.0</node.version>
		<yarn.version>v1.12.1</yarn.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>io.codekontor.slizaa</groupId>
			<artifactId>slizaa-server-main</artifactId>
			<version>${project.version}</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>

			<!-- -->
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-resources</id>
						<phase>process-classes</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${basedir}/target/classes/static/assets/slizaa</outputDirectory>
							<resources>
								<resource>
									<directory>app/build</directory>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<!-- -->
			<plugin>
				<groupId>com.github.eirslett</groupId>
				<artifactId>frontend-maven-plugin</artifactId>
				<version>${frontend-maven-plugin.version}</version>
				<configuration>
					<workingDirectory>app</workingDirectory>
				</configuration>
				<executions>
					<execution>
						<id>install node</id>
						<goals>
							<goal>install-node-and-yarn</goal>
						</goals>
						<configuration>
							<nodeVersion>${node.version}</nodeVersion>
							<yarnVersion>${yarn.version}</yarnVersion>
						</configuration>
					</execution>
					<execution>
						<id>yarn install</id>
						<goals>
							<goal>yarn</goal>
						</goals>
						<phase>generate-resources</phase>
					</execution>
					<execution>
						<id>yarn build</id>
						<goals>
							<goal>yarn</goal>
						</goals>
						<phase>compile</phase>
						<configuration>
							<arguments>run build</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>repackage</id>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<mainClass>io.codekontor.slizaa.server.web.SlizaaServerWeb</mainClass>
				</configuration>
			</plugin>

		</plugins>
	</build>

</project>
