<?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>io.github.padaiyal</groupId>
    <artifactId>popper</artifactId>
    <version>2021.12.18.a</version>
    <packaging>pom</packaging>

    <name>
        Popper
    </name>

    <description>
        A parent template project enforcing lint checks, static code analysis and unit tests with code coverage.
    </description>

    <url>https://github.com/padaiyal/jPopper.git</url>

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

    <developers>
        <developer>
            <id>the-c0d3br34k3r</id>
            <name>Ranjan Mohan</name>
            <email>ranjanmj@gmail.com</email>
        </developer>
        <developer>
            <id>silvs110</id>
            <name>Silvia Siu Luo</name>
            <email>silvia.siuluo@gmail.com</email>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git@github.com:padaiyal/jPopper.git</connection>
        <developerConnection>scm:git:ssh://github.com:padaiyal/jPopper.git</developerConnection>
        <url>https://github.com/padaiyal/jPopper</url>
        <tag>${project.version}</tag>
    </scm>

    <properties>
        <maven.compiler.target>14</maven.compiler.target>
        <maven.compiler.source>14</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <plugin.mavenSourcePlugin.version>3.2.1</plugin.mavenSourcePlugin.version>
        <plugin.mavenJavadocPlugin.version>3.2.0</plugin.mavenJavadocPlugin.version>
        <plugin.mavenGpgPlugin.version>1.6</plugin.mavenGpgPlugin.version>
        <plugin.nexusStagingMavenPlugin.version>1.6.8</plugin.nexusStagingMavenPlugin.version>
        <plugin.surefire.version>3.0.0-M5</plugin.surefire.version>
        <plugin.site.version>3.7.1</plugin.site.version>
        <plugin.projectInfoReports.version>3.0.0</plugin.projectInfoReports.version>
        <plugin.checkstyle.version>3.1.1</plugin.checkstyle.version>
        <plugin.jacoco.version>0.8.6</plugin.jacoco.version>
        <plugin.pmd.version>3.14.0</plugin.pmd.version>
        <dependency.checkstyle.version>8.38</dependency.checkstyle.version>
        <dependency.validationApi.version>2.0.1.Final</dependency.validationApi.version>
        <dependency.junit.version>5.8.2</dependency.junit.version>
        <dependency.log4j.version>2.17.0</dependency.log4j.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${plugin.mavenSourcePlugin.version}</version>
                <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-javadoc-plugin</artifactId>
                <version>${plugin.mavenJavadocPlugin.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-gpg-plugin</artifactId>
                <version>${plugin.mavenGpgPlugin.version}</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <configuration>
                            <keyname>padaiyal</keyname>
                            <passphraseServerId>BC9157EBFB6D8EBA2BF236F5B4D6FEFEEF240C3F</passphraseServerId>
                            <!-- Prevent gpg from using pinentry programs. Fixes: gpg: signing
                                failed: Inappropriate ioctl for device -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${plugin.nexusStagingMavenPlugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${plugin.surefire.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>${plugin.site.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${plugin.projectInfoReports.version}</version>
            </plugin>
            <!-- Following the instructions here to setup code autoformatting will be useful
             in addressing checkstyle failures - https://github.com/google/google-java-format
             #intellij-android-studio-and-other-jetbrains-ides
             -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${plugin.checkstyle.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${dependency.checkstyle.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <configLocation>google_checks.xml</configLocation>
                    <!--  <suppressionsLocation>suppressions.xml</suppressionsLocation> -->
                    <encoding>UTF-8</encoding>
                    <violationSeverity>warning</violationSeverity>
                    <failsOnError>true</failsOnError>
                    <failOnViolation>true</failOnViolation>
                    <consoleOutput>true</consoleOutput>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${plugin.jacoco.version}</version>
                <configuration>
                    <dataFile>${basedir}/target/jacoco.exec</dataFile>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <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>
                        <phase>test</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>CLASS</element>
                                    <!--
                                      Refer the following link to know more about supported
                                      counters and values.
                                      https://www.jacoco.org/jacoco/trunk/doc/check-mojo.html
                                      -->
                                    <limits>
                                        <limit>
                                            <counter>INSTRUCTION</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>1.00</minimum>
                                        </limit>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>1.00</minimum>
                                        </limit>
                                        <limit>
                                            <counter>BRANCH</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>1.00</minimum>
                                        </limit>
                                        <limit>
                                            <counter>COMPLEXITY</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>1.00</minimum>
                                        </limit>
                                        <limit>
                                            <counter>METHOD</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>1.00</minimum>
                                        </limit>
                                        <limit>
                                            <counter>CLASS</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>1.00</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                            <excludes>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${plugin.pmd.version}</version>
                <configuration>
                    <linkXRef>false</linkXRef>
                    <includeTests>true</includeTests>
                    <rulesets>
                        <ruleset>https://raw.githubusercontent.com/padaiyal/jPopper/main/pmd_rules.xml</ruleset>
                    </rulesets>
                    <printFailingErrors>true</printFailingErrors>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                            <goal>cpd-check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
<!--        Snippet to upload to GitHub packages.-->
<!--        <repository>-->
<!--            <id>github</id>-->
<!--            <name>jPopper MVN package deployment</name>-->
<!--            <url>https://maven.pkg.github.com/padaiyal/jPopper</url>-->
<!--        </repository>-->
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>${dependency.validationApi.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${dependency.junit.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${dependency.junit.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${dependency.log4j.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${dependency.log4j.version}</version>
        </dependency>
    </dependencies>

</project>