<?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>gr.cite.regional.data.collection</groupId>
    <artifactId>regional-data-collection-addin</artifactId>
    <version>1.0.0-4.11.0-165487</version>

    <packaging>war</packaging>

    <name>regional-data-collection-addin</name>

    <properties>
        <log4j.version>2.9.1</log4j.version>
        <org.springframework.version>4.3.13.RELEASE</org.springframework.version>
        <jackson.version>2.9.2</jackson.version>
        <regional.data.collection.model.version>0.0.1-SNAPSHOT</regional.data.collection.model.version>

        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
        <maven-war-plugin.version>3.2.0</maven-war-plugin.version>
		<maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
        <tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
            <version>${log4j.version}</version>
        </dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${org.springframework.version}</version>
		</dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>2.25.1</version>
        </dependency>
    </dependencies>

    <build>
        <finalName>regional-data-collection-addin</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
			<!--<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.6.0</version>
				<executions>
					<execution>
						<id>exec-npm-install</id>
						<phase>generate-sources</phase>
						<configuration>
							<workingDirectory>${project.basedir}/static/regional-data-collection-excel-add-in-web</workingDirectory>
							<executable>npm</executable>
							<arguments>
								<argument>install</argument>
							</arguments>
						</configuration>
						<goals>
							<goal>exec</goal>
						</goals>
					</execution>
					<execution>
						<id>exec-npm-ng-build</id>
						<phase>generate-sources</phase>
						<configuration>
							<workingDirectory>${project.basedir}/static/regional-data-collection-excel-add-in-web</workingDirectory>
							<executable>ng</executable>
							<arguments>
								<argument>build</argument>
								<argument>-prod</argument>
								<argument>&#45;&#45;base-href=/regional-data-collection-addin/static/</argument>
								<argument>&#45;&#45;output-path=${project.basedir}/target/static</argument>
							</arguments>
						</configuration>
						<goals>
							<goal>exec</goal>
						</goals>
					</execution>
				</executions>
			</plugin>-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven-war-plugin.version}</version>
                <configuration>
                    <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
					<!--<webResources>
						<resource>
							<directory>../regional-data-collection-excel-add-in-web/dist</directory>
							<includes>
								<include>**</include>
								<excludes>
									<exclude>regional-data-collection-excel-add-in-web/**</exclude>
								</excludes>
							</includes>
						</resource>
					</webResources>-->
				</configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
				<version>${maven-resources-plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals><goal>copy-resources</goal></goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/regional-data-collection-addin/static/</outputDirectory >
                            <resources>
                                <resource>
                                    <directory>${basedir}/static</directory >
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>${tomcat7-maven-plugin.version}</version>
                <configuration>
                    <path>/regional-data-collection-addin</path>
                    <port>8083</port>
                    <httpsPort>8445</httpsPort>
                    <keystoreFile>${project.build.directory}/tomcat7.keystore</keystoreFile>
                    <keystorePass>tomcat7</keystorePass>
                    <charset>UTF-8</charset>
                    <systemProperties>
                        <log4j.configurationFile>log4j2-dev.xml</log4j.configurationFile>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>keytool-maven-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <id>clean</id>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                    <execution>
                        <phase>generate-resources</phase>
                        <id>genkey</id>
                        <goals>
                            <goal>generateKeyPair</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <keystore>${project.build.directory}/tomcat7.keystore</keystore>
                    <dname>cn=localhost</dname>
                    <keypass>tomcat7</keypass>
                    <storepass>tomcat7</storepass>
                    <alias>tomca7</alias>
                    <keyalg>RSA</keyalg>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>