<?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.9.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.github.paulosalonso</groupId>
    <artifactId>crud-api-base</artifactId>
    <version>0.0.1.RP</version>
    <name>CRUD API Base</name>
    <description>Fornece implementação básica e expansível para criação API's CRUD com Spring Boot e Spring Data JPA.</description>
    <url>https://github.com/paulosalonso/crud-api-base</url>
    <developers>
        <developer>
            <id>paulosalonso</id>
            <name>Paulo Silas Alonso</name>
            <email>paulo_alonso_@hotmail.com</email>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>GNU General Public License v3.0</name>
            <url>https://github.com/paulosalonso/crud-api-base/blob/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <properties>
        <!--    DEPENDENCIES VERSION    -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <spring.boot.version>2.1.9.RELEASE</spring.boot.version>
        <spring-data-jpa-entity-graph.version>2.2.0</spring-data-jpa-entity-graph.version>
        <jackson-datatype-hibernate5.version>2.10.1</jackson-datatype-hibernate5.version>
        <querydecoder.version>2.0.1</querydecoder.version>
        <expression-specification-for-spring-data-jpa.version>1.0.0</expression-specification-for-spring-data-jpa.version>
        <springfox.version>2.9.1</springfox.version>
        <h2.version>1.4.200</h2.version>
        <modelmapper.version>2.3.0</modelmapper.version>

        <!--    PLUGINS VERSION    -->
        <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>2.22.2</maven-failsafe-plugin.version>
        <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
        <pitest-maven.version>1.5.1</pitest-maven.version>

        <!--    CONFIGURATIONS    -->
        <skip.unit.tests>true</skip.unit.tests>
        <skip.it.tests>true</skip.it.tests>
        <skip.mutation>true</skip.mutation>
        <skip.signature>false</skip.signature>
        <covered.line>0.90</covered.line>
        <covered.branch>0.90</covered.branch>
    </properties>    
    <distributionManagement>
        <snapshotRepository>
          <id>ossrh</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>    
    <scm>        
        <url>https://github.com/paulosalonso/crud-api-base.git</url>
        <connection>scm:git:https://github.com/paulosalonso/crud-api-base.git</connection>
        <developerConnection>scm:git:https://github.com/paulosalonso/crud-api-base.git</developerConnection>
        <tag>crud-api-base-0.0.1.RP</tag>
    </scm>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
			<scope>provided</scope>
		</dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.cosium.spring.data</groupId>
            <artifactId>spring-data-jpa-entity-graph</artifactId>
            <version>${spring-data-jpa-entity-graph.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-hibernate5</artifactId>
            <version>${jackson-datatype-hibernate5.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.paulosalonso</groupId>
            <artifactId>querydecoder</artifactId>
            <version>${querydecoder.version}</version>
        </dependency>
        <dependency>
            <groupId>com.github.paulosalonso</groupId>
            <artifactId>expression-specification-for-spring-data-jpa</artifactId>
            <version>${expression-specification-for-spring-data-jpa.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>
        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>${modelmapper.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox.version}</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${springfox.version}</version>
        </dependency>

        <!--    TEST DEPENDENCIES    -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>

            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${nexus-staging-maven-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${maven-gpg-plugin.version}</version>
                <configuration>
                    <skip>${skip.signature}</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <configuration>
                            <homedir>${gpg.homedir}</homedir>
                            <passphrase>${gpg.passphrase}</passphrase>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <skipTests>${skip.unit.tests}</skipTests>
                    <argLine>
                        ${argLine} --illegal-access=permit
                    </argLine>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven-failsafe-plugin.version}</version>
                <configuration>
                    <argLine>
                        <!-- ${argLine} - necessário para funcionar o jacoco corretamente-->
                        ${argLine} --illegal-access=permit
                    </argLine>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <classesDirectory>${project.build.outputDirectory}</classesDirectory>
                            <skipTests>${skip.it.tests}</skipTests>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${covered.line}</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>${covered.branch}</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>**/configuration.*</exclude>
                        <exclude>**/core.properties.*</exclude>
                        <exclude>**/exception*.*</exclude>
                    </excludes>
                    <destFile>${project.build.directory}/jacoco.exec</destFile>
                    <fileSets>
                        <fileSet>
                            <directory>${project.basedir}/target</directory>
                            <includes>
                                <include>jacoco.exec</include>
                            </includes>
                        </fileSet>
                    </fileSets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.pitest</groupId>
                <artifactId>pitest-maven</artifactId>
                <version>${pitest-maven.version}</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>mutationCoverage</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skip>${skip.mutation}</skip>
                    <mutationThreshold>90</mutationThreshold>
                    <targetClasses>
                        <param>com.alon.spring.crud.domain*</param>
                    </targetClasses>
                    <targetTests>
                        <param>com.alon.spring.crud.domain*</param>
                    </targetTests>
                    <excludedTestClasses>
                        <param>*IT</param>
                    </excludedTestClasses>
                    <avoidCallsTo>
                        <avoidCallsTo>java.util.logging</avoidCallsTo>
                        <avoidCallsTo>org.apache.log4j</avoidCallsTo>
                        <avoidCallsTo>org.slf4j</avoidCallsTo>
                        <avoidCallsTo>org.apache.commons.logging</avoidCallsTo>
                    </avoidCallsTo>
                </configuration>
            </plugin>

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