<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>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>

    <groupId>org.meridor.perspective</groupId>
    <artifactId>perspective-backend</artifactId>
    <version>1.3.3</version>
    <packaging>pom</packaging>

    <name>Perspective Backend</name>

    <properties>
        <compiler.version>1.8</compiler.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <slf4j.version>1.7.21</slf4j.version>
        <log4j.version>1.2.17</log4j.version>
        <junit.version>4.12</junit.version>
        <hamcrest.version>1.3</hamcrest.version>
        <mockito.version>1.9.5</mockito.version>
        <stecker.version>1.0.1</stecker.version>
        <spring.version>4.3.3.RELEASE</spring.version>
        <spring-shell.version>1.2.0.RELEASE</spring-shell.version>
        <hazelcast.version>3.7.3</hazelcast.version>
        <aspectj.version>1.8.9</aspectj.version>
        <yatomata.version>1.7</yatomata.version>
        <openstack4j.version>3.0.0</openstack4j.version>
        <undertow.version>1.4.0.Final</undertow.version>
        <digitalocean-api-client.version>2.7</digitalocean-api-client.version>
        <tyrus.version>1.13</tyrus.version>
    </properties>

    <modules>
        <module>perspective-beans</module>
        <module>perspective-backend-common</module>
        <module>perspective-sql</module>
        <module>perspective-storage</module>
        <module>perspective-rest</module>
        <module>perspective-java-client</module>
        <module>perspective-worker</module>
        <module>perspective-openstack</module>
        <module>perspective-docker</module>
        <module>perspective-shell</module>
        <module>perspective-api-common</module>
        <module>perspective-digital-ocean</module>
        <module>perspective-common</module>
    </modules>

    <dependencyManagement>
        <dependencies>

            <!-- Modules -->
            <dependency>
                <groupId>org.meridor.perspective</groupId>
                <artifactId>perspective-rest</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.meridor.perspective</groupId>
                <artifactId>perspective-beans</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.meridor.perspective</groupId>
                <artifactId>perspective-backend-common</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.meridor.perspective</groupId>
                <artifactId>perspective-worker</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.meridor.perspective</groupId>
                <artifactId>perspective-java-client</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.meridor.perspective</groupId>
                <artifactId>perspective-sql</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.meridor.perspective</groupId>
                <artifactId>perspective-api-common</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.meridor.perspective</groupId>
                <artifactId>perspective-common</artifactId>
                <version>${project.version}</version>
            </dependency>

            <!-- Hazelcast -->
            <dependency>
                <groupId>com.hazelcast</groupId>
                <artifactId>hazelcast-client</artifactId>
                <version>${hazelcast.version}</version>
            </dependency>
            <dependency>
                <groupId>com.hazelcast</groupId>
                <artifactId>hazelcast-spring</artifactId>
                <version>${hazelcast.version}</version>
            </dependency>

            <!-- Spring -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${spring.version}</version>
                <scope>test</scope>
            </dependency>

            <!-- Misc -->
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjweaver</artifactId>
                <version>${aspectj.version}</version>
            </dependency>
            <dependency>
                <groupId>ru.yandex.qatools</groupId>
                <artifactId>yatomata</artifactId>
                <version>${yatomata.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.tyrus</groupId>
                <artifactId>tyrus-client</artifactId>
                <version>${tyrus.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.tyrus</groupId>
                <artifactId>tyrus-container-grizzly-client</artifactId>
                <version>${tyrus.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.tyrus.tests</groupId>
                <artifactId>tyrus-test-tools</artifactId>
                <version>${tyrus.version}</version>
                <scope>test</scope>
            </dependency>


            <!-- Testing -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-library</artifactId>
                <version>${hamcrest.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>${mockito.version}</version>
                <scope>test</scope>
            </dependency>

            <!-- Logging -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.16</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.10</version>
                    <executions>
                        <execution>
                            <id>copy-dependencies</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                <overWriteReleases>false</overWriteReleases>
                                <overWriteSnapshots>false</overWriteSnapshots>
                                <overWriteIfNewer>true</overWriteIfNewer>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.5.5</version>
                    <executions>
                        <execution>
                            <id>copy-docker-files</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <configuration>
                                <!-- This one prepares Dockerfile and entrypoints.sh with current version using filtering -->
                                <finalName>docker-filtered</finalName>
                                <descriptors>
                                    <descriptor>${project.parent.basedir}/docker/docker-assembly.xml</descriptor>
                                </descriptors>
                                <outputDirectory>${project.build.directory}</outputDirectory>
                                <appendAssemblyId>false</appendAssemblyId>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>0.4.13</version>
                    <executions>
                        <execution>
                            <id>build-image</id>
                            <phase>package</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                            <configuration>
                                <!-- Here we use Docker data prepared during the previous step -->
                                <dockerDirectory>${project.build.directory}/docker-filtered</dockerDirectory>
                                <imageName>${project.artifactId}:${project.version}</imageName>
                                <resources>
                                    <resource>
                                        <targetPath>/</targetPath>
                                        <directory>${project.build.directory}</directory>
                                        <include>${project.build.finalName}.jar</include>
                                    </resource>
                                    <resource>
                                        <targetPath>lib</targetPath>
                                        <directory>${project.build.directory}/lib</directory>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                        <execution>
                            <id>tag-image</id>
                            <phase>package</phase>
                            <goals>
                                <goal>tag</goal>
                            </goals>
                            <configuration>
                                <image>${project.artifactId}:${project.version}</image>
                                <newName>meridor/${project.artifactId}:${project.version}</newName>
                            </configuration>
                        </execution>
                        <execution>
                            <id>push-image</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>push</goal>
                            </goals>
                            <configuration>
                                <imageName>meridor/${project.artifactId}:${project.version}</imageName>
                                <useConfigFile>true</useConfigFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>${compiler.version}</source>
                    <target>${compiler.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <fail>true</fail>
                            <rules>
                                <requireMavenVersion>
                                    <message>Version of Maven required to build the project should be
                                        ${project.prerequisites.maven}, or higher!
                                    </message>
                                    <version>[${project.prerequisites.maven},)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <message>Current JDK version ${java.version} should be ${compiler.version}, or higher!
                                    </message>
                                    <version>${compiler.version}</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <configuration>
                    <additionalparam>-Xdoclint:none</additionalparam>
                    <author>false</author>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.7.201606060606</version>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <argLine>${surefireArgLine}</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <organization>
        <name>Meridor</name>
        <url>http://meridor.org/</url>
    </organization>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/meridor/perspective-backend</url>
        <connection>scm:git@github.com:meridor/perspective-backend.git</connection>
        <developerConnection>scm:git:git@github.com:meridor/perspective-backend.git</developerConnection>
    </scm>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/meridor/perspective-backend/issues</url>
    </issueManagement>

    <ciManagement>
        <system>Travis</system>
        <url>https://travis-ci.org/meridor/perspective-backend</url>
    </ciManagement>

    <developers>
        <developer>
            <id>vania-pooh</id>
            <name>Ivan Krutov</name>
            <email>support@meridor.org</email>
            <organization>Meridor</organization>
        </developer>
    </developers>

    <repositories>
        <repository>
            <id>sonatype-snapshots-repo</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>
