<?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>org.onap.vid</groupId>
    <artifactId>vid-ext-services-simulator</artifactId>
    <version>1.0.0</version>
    <name>VID Simulator</name>
    <packaging>war</packaging>
    <description>VID Simulator for mocking external peers</description>

    <properties>
        <encoding>UTF-8</encoding>
        <springframework.version>5.1.6.RELEASE</springframework.version>
        <hibernate.version>5.3.4.Final</hibernate.version>
        <jackson.version>2.9.8</jackson.version>
        <!-- Skip assembling the zip by default -->
        <skipassembly>true</skipassembly>
        <!-- Tests usually require some setup that maven cannot do, so skip. -->
        <skiptests>true</skiptests>
        <!-- this should be commented for local debugging -->
        <!-- <deployenv>local</deployenv> -->
        <nexusproxy>https://nexus.onap.org</nexusproxy>
        <stagingNexusPath>content/repositories/staging/</stagingNexusPath>
        <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath>
        <releaseNexusPath>content/repositories/releases/</releaseNexusPath>

        <!-- "none" will skip cobertura by default; enable the profile "cobertura" to enable it -->
        <coberturaBuildPhase>none</coberturaBuildPhase>

        <!-- will build docker-maven-plugin by default; enable the profile "no-docker" to disable it -->
        <skipDockerBuild>false</skipDockerBuild>
        <dockerBuildPhase>package</dockerBuildPhase>
        <dockerPushPhase>deploy</dockerPushPhase>
    </properties>

    <profiles>
        <profile>
            <id>onap</id>
            <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
                <nexusproxy>https://nexus.onap.org</nexusproxy>
                <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath>
                <releaseNexusPath>content/repositories/releases/</releaseNexusPath>
                <stagingNexusPath>content/repositories/staging/</stagingNexusPath>
                <sitePath>content/sites/site/org/openecomp/vid/${project.version}</sitePath>
            </properties>

            <repositories>
                <repository>
                    <id>oss-snapshots</id>
                    <name>oss Central - Snapshots</name>
                    <url>https://oss.sonatype.org/service/local/repositories/releases/content/</url>
                </repository>
            </repositories>
        </profile>

        <profile>
            <id>default</id>
        </profile>

        <!-- disable doclint, a new feature in Java 8, when generating javadoc -->
        <profile>
            <id>doclint-java8-disable</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.4</version>
                        <configuration>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>cobertura</id>
            <properties>
                <coberturaBuildPhase>package</coberturaBuildPhase>
            </properties>
        </profile>

        <profile>
            <id>no-docker</id>
            <properties>
                <skipDockerBuild>true</skipDockerBuild>
                <dockerBuildPhase>none</dockerBuildPhase>
                <dockerPushPhase>none</dockerPushPhase>
            </properties>
        </profile>

        <profile>
            <id>docker-proxy</id>
            <!-- activate profile if environment variable `http_proxy` is set -->
            <activation>
                <property>
                    <name>env.http_proxy</name>
                </property>
            </activation>
            <properties>
                <docker.buildArg.http_proxy>${env.http_proxy}</docker.buildArg.http_proxy>
            </properties>
        </profile>

    </profiles>

    <dependencies>
        <!-- mockserver -->
        <dependency>
            <groupId>org.mock-server</groupId>
            <artifactId>mockserver-netty</artifactId>
            <version>3.11</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.11</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <version>2.2.6</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <version>1.0.0.Final</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.0</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>vidSimulator</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.27.2</version>

                <configuration>
                    <skip>${skipDockerBuild}</skip>
                    <images>
                        <image>
                            <name>onap/vid-simulator</name>
                            <build>
                                <cleanup>remove</cleanup>
                                <dockerFileDir>${project.basedir}</dockerFileDir>
                                <tags>
                                    <tag>${project.version}</tag>
                                    <tag>latest</tag>
                                </tags>
                            </build>
                        </image>
                    </images>
                </configuration>

                <executions>
                    <execution>
                        <id>generate-image</id>
                        <phase>${dockerBuildPhase}</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>

                    <execution>
                        <id>push-image</id>
                        <phase>${dockerPushPhase}</phase>
                        <goals>
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>

            </plugin>

        </plugins>
    </build>
</project>