<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License (MIT)

Copyright (c) 2019 Vedran Grgo Vatavuk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
 -->
<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>hr.com.vgv</groupId>
    <artifactId>parent</artifactId>
    <version>0.1.0</version>
    <name>parent</name>
    <description>Parent Maven POM</description>
    <url>https://github.com/Vatavuk/${project.name}</url>
    <packaging>pom</packaging>
    <licenses>
        <license>
            <name>MIT</name>
            <url>https://github.com/Vatavuk/vgv-parent/blob/master/LICENSE</url>
            <distribution>repo</distribution>
            <comments>MIT License</comments>
        </license>
    </licenses>
    <developers>
        <developer>
            <id>1</id>
            <name>Vedran Grgo Vatavuk</name>
            <email>123vgv@gmail.com</email>
            <roles>
                <role>Architect</role>
                <role>Developer</role>
            </roles>
            <timezone>-7</timezone>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:github.com:Vatavuk/${project.name}.git</connection>
        <developerConnection>scm:git:github.com:Vatavuk/${project.name}.git</developerConnection>
        <url>https://github.com/Vatavuk/${project.name}</url>
    </scm>
    <distributionManagement>
        <downloadUrl>https://oss.sonatype.org/content/groups/public</downloadUrl>
        <repository>
            <id>oss.sonatype.org</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
        <snapshotRepository>
            <id>oss.sonatype.org</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>
    <properties>
        <project.name>vgv-parent</project.name>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <!--
        ISO 8601, see http://en.wikipedia.org/wiki/ISO_8601. This
        property is defined in order to give us an ability to use ${maven.build.timestamp}
        later in the file
        -->
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <instruction.covered.ratio>0.7</instruction.covered.ratio>
        <line.covered.ratio>0.7</line.covered.ratio>
        <branch.covered.ratio>0.6</branch.covered.ratio>
        <method.covered.ratio>0.6</method.covered.ratio>
    </properties>
    <repositories>
        <!--
        You should keep it empty in your project.
        @see http://www.sonatype.com/people/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/
        -->
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>oss.sonatype.org</id>
            <url>https://oss.sonatype.org/content/groups/public</url>
        </pluginRepository>
    </pluginRepositories>
    <profiles>
        <profile>
            <!--
            The profile deploys all artifacts to oss.sonatype.org
            repository (if you're registered there). It also skips
            default deployment plugin.
            -->
            <id>mavenCentral</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <artifactId>maven-deploy-plugin</artifactId>
                            <configuration>
                                <skip>true</skip>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-sources</id>
                                <configuration>
                                    <forceCreation>true</forceCreation>
                                </configuration>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <!--
                        Generate -javadoc.jar artifact, required by Maven Central.
                        -->
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-javadoc</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <!--
                        To GPG-sign the artifact before deployment to foreign
                        repository. GPG keys have to be provided in CI
                        environment, and published beforehand.
                        @link http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/
                        -->
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <!-- @see http://www.sonatype.com/books/nexus-book/reference/staging-sect-deployment.html -->
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>oss.sonatype.org</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        </configuration>
                        <executions>
                            <execution>
                                <id>deploy-to-sonatype</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>deploy</goal>
                                    <goal>release</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jacoco</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.7</version>
                        <configuration>
                            <output>file</output>
                        </configuration>
                        <executions>
                            <execution>
                                <id>jacoco-initialize</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>jacoco-check</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <excludes>
                                        <exclude>**/*Envelope.class</exclude>
                                    </excludes>
                                    <rules>
                                        <rule>
                                            <element>BUNDLE</element>
                                            <limits>
                                                <limit>
                                                    <counter>INSTRUCTION</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>${instruction.covered.ratio}</minimum>
                                                </limit>
                                                <limit>
                                                    <counter>LINE</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>${line.covered.ratio}</minimum>
                                                </limit>
                                                <limit>
                                                    <counter>BRANCH</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>${branch.covered.ratio}</minimum>
                                                </limit>
                                                <limit>
                                                    <counter>METHOD</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>${method.covered.ratio}</minimum>
                                                </limit>
                                            </limits>
                                        </rule>
                                    </rules>
                                </configuration>
                            </execution>
                            <execution>
                                <id>jacoco-site</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!--
            Static quality analysis with Qulice and other tools.
            This profile is supposed to be activated in continuous
            integration environment, right before the final approval
            of the build. It runs a number of static code analysis
            tools to validate and approve the quality of source
            code and the SCM repository.
            @see http://www.jcabi.com/jcabi-parent/profile-qulice.html
            -->
            <id>qulice</id>
            <build>
                <plugins>
                    <plugin>
                        <!--
                        Qulice-maven-plugin is a compound static analysis
                        tool that aggregates Checkstyle, PMD, FindBugs,
                        CodeNarc (for Groovy code) and a few other analyzers.
                        Qulice also configures them correctly to enable the
                        most important rules.
                        @see http://www.qulice.com/qulice-maven-plugin/
                        -->
                        <groupId>com.qulice</groupId>
                        <artifactId>qulice-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>qulice-check</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <license>file:${basedir}/LICENSE</license>
                                    <excludes>
                                        <exclude>xml:.*</exclude>
                                        <exclude>checkstyle:/src/site/resources/.*</exclude>
                                        <exclude>findbugs:.*</exclude>
                                        <exclude>duplicatefinder:.*</exclude>
                                        <exclude>dependencies:javax.ws.rs:javax.ws.rs-api</exclude>
                                        <exclude>dependencies:org.glassfish.jersey.core:jersey-common</exclude>
                                    </excludes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!--
            Enable unit testing. The profile is activated when you have
            src/test/java directory in the project. It will add test artifacts
            to the classpath ("test" scope).
            -->
            <id>junit</id>
            <activation>
                <file>
                    <exists>${basedir}/src/test/java</exists>
                </file>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.junit.jupiter</groupId>
                    <artifactId>junit-jupiter-api</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.junit.jupiter</groupId>
                    <artifactId>junit-jupiter-engine</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.assertj</groupId>
                    <artifactId>assertj-core</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-library</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.mockito</groupId>
                    <artifactId>mockito-core</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
    <build>
        <resources>
            <!--
            Filter resources in "process-resources" phase
            @link http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
            -->
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <testResources>
            <!--
            Filter resources in "process-resources" phase
            @link http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html
            -->
            <testResource>
                <directory>${basedir}/src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <parallel>suites</parallel>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>[3.2.5,)</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!--
                This plugin will collect current build number
                from Git and save it into Maven property
                -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <id>build-number</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>create</goal>
                            <goal>create-timestamp</goal>
                        </goals>
                        <configuration>
                            <buildNumberPropertyName>buildNumber</buildNumberPropertyName>
                            <timestampPropertyName>timestamp</timestampPropertyName>
                            <timestampFormat>{0,date,yyyy-MM-dd'T'HH:mm:ss}</timestampFormat>
                            <doCheck>false</doCheck>
                            <doUpdate>false</doUpdate>
                            <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
                            <shortRevisionLength>7</shortRevisionLength>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.32</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>1.2.5</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>5.7.2</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>5.7.2</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>3.20.2</version>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-core</artifactId>
                <version>2.2</version>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-library</artifactId>
                <version>2.2</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>3.12.4</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.hamcrest</groupId>
                        <artifactId>hamcrest-core</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

