<?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.2.1.RELEASE</version>
        <relativePath/>
    </parent>

    <groupId>com.cooldatasoft</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.1.RELEASE</version>
    <packaging>pom</packaging>

    <description>Parent project for SpringBoot Projects with preconfigured plugins</description>
    <url>https://github.com/cooldatasoft/spring-boot-starter-parent</url>
    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Fatih Mehmet UCAR</name>
            <email>fmucar@cooldatasoft.com</email>
            <organization>Cooldatasoft</organization>
            <organizationUrl>http://www.cooldatasoft.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/cooldatasoft/spring-boot-starter-parent.git</connection>
        <developerConnection>scm:git:ssh://github.com:cooldatasoft/spring-boot-starter-parent.git</developerConnection>
        <url>http://github.com/cooldatasoft/spring-boot-starter-parent/tree/develop</url>
    </scm>

    <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>

    <properties>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.site.outputEncoding>UTF-8</maven.site.outputEncoding>

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <!--********* CHECKSTYLE Rules *********-->
        <build-tools.groupId>com.cooldatasoft</build-tools.groupId>
        <build-tools.artifactId>build-tools</build-tools.artifactId>
        <build-tools.version>1.0.1</build-tools.version>

        <!-- CHECKSTYLE settings -->
        <checkstyle.config.location>checkstyle/checkstyle-rules.xml</checkstyle.config.location>
        <checkstyle.consoleOutput>true</checkstyle.consoleOutput>
        <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
        <checkstyle.failsOnError>true</checkstyle.failsOnError>
        <checkstyle.includeTestSourceDirectory>true</checkstyle.includeTestSourceDirectory>
        <checkstyle.suppressions.location>checkstyle/checkstyle-suppressions.xml</checkstyle.suppressions.location>
        <checkstyle.version>8.24</checkstyle.version>


        <!-- PMD Settings -->
        <pmd.failOnViolation>true</pmd.failOnViolation>
        <pmd.printFailingErrors>true</pmd.printFailingErrors>

        <!-- JACOCO Settings -->
        <jacoco.line.coveredRatio>0.70</jacoco.line.coveredRatio>

        <!-- DOCKER Settings-->
        <docker.image.prefix>cooldatasoft</docker.image.prefix>


        <!-- FINDBUGS Settings-->
        <findbugs.version>3.0.1</findbugs.version>

        <!--********* Plugin Versions *********-->
        <maven-changes-plugin.version>2.12.1</maven-changes-plugin.version>
        <maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
        <maven-cucumber-reporting.version>4.9.0</maven-cucumber-reporting.version>
        <maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
        <maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version>
        <maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
        <maven-jxr-plugin.version>3.0.0</maven-jxr-plugin.version>
        <maven-pmd-plugin.version>3.12.0</maven-pmd-plugin.version>
        <maven-project-info-reports-plugin.version>3.0.0</maven-project-info-reports-plugin.version>
        <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
        <maven-source-plugin.version>3.1.0</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.0.0-M3</maven-surefire-plugin.version>
        <maven-surefire-report-plugin.version>3.0.0-M3</maven-surefire-report-plugin.version>

        <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
        <dockerfile-maven-plugin.version>1.4.12</dockerfile-maven-plugin.version>
        <findbugs-maven-plugin.version>3.0.5</findbugs-maven-plugin.version>
        <jacoco-maven-plugin.version>0.8.4</jacoco-maven-plugin.version>
        <tidy-maven-plugin.version>1.1.0</tidy-maven-plugin.version>
    </properties>

    <build>
        <pluginManagement>
            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-changes-plugin</artifactId>
                    <version>${maven-changes-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${maven-checkstyle-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>${build-tools.groupId}</groupId>
                            <artifactId>${build-tools.artifactId}</artifactId>
                            <version>${build-tools.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>checkstyle</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <consoleOutput>${checkstyle.consoleOutput}</consoleOutput>
                                <failOnViolation>${checkstyle.failOnViolation}</failOnViolation>
                                <failsOnError>${checkstyle.failsOnError}</failsOnError>
                                <includeTestSourceDirectory>${checkstyle.includeTestSourceDirectory}
                                </includeTestSourceDirectory>
                                <outputFile>${project.build.directory}/checkstyle/result.xml</outputFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>net.masterthought</groupId>
                    <artifactId>maven-cucumber-reporting</artifactId>
                    <version>${maven-cucumber-reporting.version}</version>
                    <executions>
                        <execution>
                            <id>execution</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                            <configuration>
                                <projectName>${project.artifactId}</projectName>
                                <!-- optional, per documentation set this to "true" to bypass generation of Cucumber Reports entirely,
                                defaults to false if not specified -->
                                <skip>false</skip>
                                <!-- output directory for the generated report -->
                                <outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
                                <!-- optional, defaults to outputDirectory if not specified -->
                                <inputDirectory>${project.build.directory}/</inputDirectory>
                                <jsonFiles>
                                    <!-- supports wildcard or name pattern -->
                                    <param>**/*.json</param>
                                </jsonFiles>
                                <!-- optional, set true to fail build on test failures -->
                                <checkBuildResult>false</checkBuildResult>
                            </configuration>

                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>unpack</id>
                            <phase>package</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>${project.groupId}</groupId>
                                        <artifactId>${project.artifactId}</artifactId>
                                        <version>${project.version}</version>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>enforce-rules</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireJavaVersion>
                                        <version>1.8</version>
                                    </requireJavaVersion>
                                    <requireProperty>
                                        <property>project.name</property>
                                    </requireProperty>
                                    <requireProperty>
                                        <property>project.description</property>
                                    </requireProperty>
                                </rules>
                                <fail>true</fail>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>



                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jxr-plugin</artifactId>
                    <version>${maven-jxr-plugin.version}</version>
                    <configuration>
                        <linkJavadoc>true</linkJavadoc>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.4</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${maven-pmd-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>pmd-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>cpd-check</id>
                            <goals>
                                <goal>cpd-check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <minimumTokens>100</minimumTokens>
                        <printFailingErrors>true</printFailingErrors>
                        <excludeRoots>
                            <excludeRoot>${basedir}/target/generated-sources</excludeRoot>
                        </excludeRoots>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>${maven-project-info-reports-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                    <configuration>
                        <checkModificationExcludes>
                            <checkModificationExclude>pom.xml</checkModificationExclude>
                            <checkModificationExclude>src/main/resources/VERSION</checkModificationExclude>
                        </checkModificationExcludes>
                    </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>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <systemPropertyVariables>
                            <env>test</env>
                        </systemPropertyVariables>
                    </configuration>
                    <executions>
                        <execution>
                            <id>integration-tests</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <includes>
                                    <include>**/*IT.java</include>
                                </includes>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <version>${maven-surefire-report-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${build-helper-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>generate-test-sources</phase>
                            <goals>
                                <goal>add-test-source</goal>
                            </goals>
                            <configuration>
                                <sources>src/test/cucumber</sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>dockerfile-maven-plugin</artifactId>
                    <version>${dockerfile-maven-plugin.version}</version>
                    <configuration>
                        <repository>${docker.image.prefix}/${project.artifactId}</repository>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>findbugs-maven-plugin</artifactId>
                    <version>${findbugs-maven-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.google.code.findbugs</groupId>
                            <artifactId>findbugs</artifactId>
                            <version>${findbugs.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>analyze</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <findbugsXmlOutputDirectory>${project.build.directory}/findbugs</findbugsXmlOutputDirectory>
                        <onlyAnalyze>com.cooldatasoft.*</onlyAnalyze>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                    <configuration>
                        <excludes>
                            <excludes>**/com/generated-sources/package/**</excludes>
                        </excludes>
                        <rules>
                            <rule>
                                <element>BUNDLE</element>
                                <limits>
                                    <limit>
                                        <counter>LINE</counter>
                                        <value>COVEREDRATIO</value>
                                        <minimum>${jacoco.line.coveredRatio}</minimum>
                                    </limit>
                                </limits>
                            </rule>
                        </rules>
                    </configuration>
                    <executions>
                        <execution>
                            <id>initialize</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>default-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>tidy-maven-plugin</artifactId>
                    <version>${tidy-maven-plugin.version}</version>
                </plugin>

            </plugins>
        </pluginManagement>

    </build>

    <profiles>
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>changes-report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>
</project>
