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

	<groupId>ru.penkrat.fizman</groupId>
	<artifactId>fizman-widget-schedule</artifactId>
	<version>0.15-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>fizman-widget-schedule-webjar</name>
	<description>Schedule widget for fizman</description>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<destDir>${project.build.outputDirectory}/META-INF/resources/widget-schedule</destDir>
	</properties>

	<build>

		<plugins>
			<plugin>
				<groupId>com.github.eirslett</groupId>
				<artifactId>frontend-maven-plugin</artifactId>
				<version>1.3</version>
				<configuration>
					<nodeVersion>v12.2.0</nodeVersion>
					<!-- optional: with node version greater than 4.0.0 will use npm provided 
						by node distribution -->
					<npmVersion>6.9.0</npmVersion>
				</configuration>
				<executions>
					<execution>
						<!-- optional: you don't really need execution ids, but it looks nice 
							in your build log. -->
						<id>install node and npm</id>
						<goals>
							<goal>install-node-and-npm</goal>
						</goals>
						<!-- optional: default phase is "generate-resources" -->
						<phase>generate-resources</phase>
					</execution>
					<execution>
						<id>npm install</id>
						<goals>
							<goal>npm</goal>
						</goals>
						<!-- optional: default phase is "generate-resources" -->
						<phase>generate-resources</phase>
						<configuration>
							<!-- optional: The default argument is actually "install", so unless 
								you need to run some other npm command, you can remove this whole <configuration> 
								section. -->
							<arguments>install</arguments>
						</configuration>
					</execution>
					<execution>
						<id>angular-cli install</id>
						<goals>
							<goal>npm</goal>
						</goals>
						<configuration>
							<arguments>install --no-optional @angular/cli@8</arguments>
						</configuration>
					</execution>
					<execution>
						<id>npm run-script prod</id>
						<goals>
							<goal>npm</goal>
						</goals>

						<!-- optional: the default phase is "generate-resources" -->
						<phase>generate-resources</phase>

						<configuration>
							<!-- optional: if not specified, it will run webpack's default build 
								(and you can remove this whole <configuration> section.) -->
							<arguments>run-script build:prod</arguments>
						</configuration>
					</execution>
				</executions>
			</plugin>


			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>3.0.2</version>
				<executions>
					<execution>
						<id>copy-resources</id>
						<!-- here the phase you need -->
						<phase>process-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${destDir}</outputDirectory>
							<resources>
								<resource>
									<directory>dist</directory>
									<filtering>false</filtering>
									<excludes>
										<exclude>**/index.html</exclude>
									</excludes>
								</resource>
								<resource>
									<directory>dist</directory>
									<filtering>true</filtering>
									<includes>
										<include>**/index.html</include>
									</includes>
								</resource>
							</resources>
						</configuration>
					</execution>
					<execution>
						<id>copy-resources-2</id>
						<!-- here the phase you need -->
						<phase>process-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<outputDirectory>${destDir}</outputDirectory>
							<resources>
								<resource>
									<directory>src</directory>
									<filtering>false</filtering>
									<includes>
										<include>favicon.ico</include>
										<include>index.html</include>
									</includes>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>buildnumber-maven-plugin</artifactId>
				<version>1.4</version>
				<executions>
					<execution>
						<phase>validate</phase>
						<goals>
							<goal>create</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<doCheck>false</doCheck>
					<doUpdate>false</doUpdate>
					<revisionOnScmFailure>true</revisionOnScmFailure>
					<format>{0,date,yyyyMMddHHmm}</format>
					<items>
						<item>timestamp</item>
					</items>
				</configuration>
			</plugin>

			<plugin>
				<groupId>com.amashchenko.maven.plugin</groupId>
				<artifactId>gitflow-maven-plugin</artifactId>
				<version>1.12.0</version>
      		</plugin>
		</plugins>

		<extensions>
			<extension>
				<groupId>org.apache.maven.wagon</groupId>
				<artifactId>wagon-webdav-jackrabbit</artifactId>
				<version>2.8</version>
			</extension>
		</extensions>
	</build>

    <distributionManagement>
        <repository>
            <id>${deployment.releases.id}</id>
            <name>Releases</name>
            <url>${deployment.releases.url}</url>
        </repository>
        <snapshotRepository>
            <id>${deployment.snapshots.id}</id>
            <name>Snapshots</name>
            <url>${deployment.snapshots.url}</url>
        </snapshotRepository>
    </distributionManagement>	

   	<scm>
		<connection>scm:git:ssh://git@git.penkrat.ru:10022/ruslan/fizman-widget-schedule.git</connection>
		<developerConnection>scm:git:ssh://git@git.penkrat.ru:10022/ruslan/fizman-widget-schedule.git</developerConnection>
		<url>ssh://git@git.penkrat.ru:10022/ruslan/fizman-widget-schedule.git</url>
	</scm>

</project>