<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.github.hypfvieh.cli</groupId>
    <artifactId>cli-parser</artifactId>
    <version>1.0.3</version>
    <packaging>jar</packaging>

    <name>${project.artifactId}</name>

    <description>Library to provide support for command-line parsing</description>
    <url>https://github.com/hypfvieh/${project.artifactId}</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://github.com/hypfvieh/${project.artifactId}/blob/master/LICENSE</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>hypfvieh</id>
            <name>David M.</name>
            <email>hypfvieh@googlemail.com</email>
        </developer>
        <developer>
            <id>sman81</id>
            <name>Markus S.</name>
            <email>sman81@outlook.de</email>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:ssh//git@github.com/hypfvieh/${project.artifactId}.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/hypfvieh/${project.artifactId}.git</developerConnection>
        <url>ssh://git@github.com/hypfvieh/${project.artifactId}.git</url>
      <tag>cli-parser-1.0.3</tag>
  </scm>

    <distributionManagement>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <javaVersion>11</javaVersion>

        <!-- the -release argument for the Java compiler (since Java 9) -->
        <maven.compiler.release>${javaVersion}</maven.compiler.release>
        <!-- the -source argument for the Java compiler -->
        <maven.compiler.source>${javaVersion}</maven.compiler.source>
        <!-- the -target argument for the Java compiler -->
        <maven.compiler.target>${javaVersion}</maven.compiler.target>

        <dep.plugin.clean.version>3.2.0</dep.plugin.clean.version>
        <dep.plugin.source.version>3.2.1</dep.plugin.source.version>
        <dep.plugin.compiler.version>3.10.1</dep.plugin.compiler.version>
        <dep.plugin.resources.version>3.3.0</dep.plugin.resources.version>
        <dep.plugin.jar.version>3.3.0</dep.plugin.jar.version>
        <dep.plugin.deploy.version>3.0.0</dep.plugin.deploy.version>
        <dep.plugin.install.version>3.0.1</dep.plugin.install.version>
        <dep.plugin.release.version>3.0.0-M7</dep.plugin.release.version>
        <dep.plugin.javadoc.version>3.4.1</dep.plugin.javadoc.version>
        <dep.plugin.surefire.version>3.0.0-M7</dep.plugin.surefire.version>
        <dep.plugin.enforcer.version>3.1.0</dep.plugin.enforcer.version>
        <dep.plugin.gpg.version>3.0.1</dep.plugin.gpg.version>
        <dep.plugin.checkstyle.version>3.2.0</dep.plugin.checkstyle.version>
        <dep.plugin.pmd.version>3.19.0</dep.plugin.pmd.version>
        <dep.plugin.spotbugs.version>4.7.2.1</dep.plugin.spotbugs.version>
        <dep.plugin.site.version>4.0.0-M3</dep.plugin.site.version>

        <dep.checkstyle.version>10.8.0</dep.checkstyle.version>
        <dep.pmd.version>6.55.0</dep.pmd.version>
        <dep.spotbugs.version>4.7.3</dep.spotbugs.version>

        <dep.junit-jupiter.version>5.9.2</dep.junit-jupiter.version>
        <dep.slf4j-api.version>2.0.6</dep.slf4j-api.version>

        <proj.check.skip-checkstyle>false</proj.check.skip-checkstyle>
        <proj.check.skip-pmd>false</proj.check.skip-pmd>
        <proj.check.skip-spotbugs>false</proj.check.skip-spotbugs>

        <proj.check.fail-checkstyle>true</proj.check.fail-checkstyle>
        <proj.check.fail-pmd>true</proj.check.fail-pmd>
        <proj.check.fail-spotbugs>true</proj.check.fail-spotbugs>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${dep.slf4j-api.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${dep.slf4j-api.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- JUnit testing framework. -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${dep.junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${dep.junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${dep.junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>1.9.2</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>

        <pluginManagement>
            <plugins>

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

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${dep.plugin.compiler.version}</version>
                    <configuration>
                        <debug>true</debug>
                        <debuglevel>lines,vars,source</debuglevel>
                        <showWarnings>true</showWarnings>
                        <showDeprecation>true</showDeprecation>
                        <compilerArgs>
                            <arg>-parameters</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>

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

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

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${dep.plugin.jar.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>test-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

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

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${dep.plugin.surefire.version}</version>
                    <configuration>
                        <forkCount>1</forkCount>
                        <reuseForks>false</reuseForks>
                        <threadCount>1</threadCount>
                        <!-- Allow usage of 'require static' JPMS modules in test -->
                        <argLine>--add-modules=ALL-MODULE-PATH</argLine>
                    </configuration>
                </plugin>

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

            </plugins>

        </pluginManagement>

        <plugins>

            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${dep.plugin.enforcer.version}</version>

                <configuration>
                    <rules>
                        <requireMavenVersion>
                            <version>3.5.3</version>
                        </requireMavenVersion>
                    </rules>
                </configuration>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${dep.plugin.checkstyle.version}</version>
                <configuration>
                    <skip>${proj.check.skip-checkstyle}</skip>
                    <failOnViolation>${proj.check.fail-checkstyle}</failOnViolation>
                    <configLocation>src/test/resources/policy/checkstyle_rules.xml</configLocation>
                    <excludes>**/target/**,**/generated-sources/**,*.jpg,*.jpeg,*.gif,*.png,*.db,*.csv</excludes>
                    <consoleOutput>true</consoleOutput>
                    <logViolationsToConsole>true</logViolationsToConsole>
                    <violationSeverity>warning</violationSeverity>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${dep.checkstyle.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>proj.default</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${dep.plugin.pmd.version}</version>
                <configuration>
                    <skip>${proj.check.skip-pmd}</skip>
                    <failOnViolation>${proj.check.fail-pmd}</failOnViolation>
                    <printFailingErrors>true</printFailingErrors>
                    <failurePriority>4</failurePriority>
                    <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
                     <!-- minimum number of tokens that need to be duplicated before it causes a violation: -->
                    <minimumTokens>100</minimumTokens>
                    <rulesets>
                        <ruleset>src/test/resources/policy/pmd_rules.xml</ruleset>
                    </rulesets>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>net.sourceforge.pmd</groupId>
                        <artifactId>pmd-core</artifactId>
                        <version>${dep.pmd.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>net.sourceforge.pmd</groupId>
                        <artifactId>pmd-java</artifactId>
                        <version>${dep.pmd.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>proj.default</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${dep.plugin.spotbugs.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs</artifactId>
                        <version>${dep.spotbugs.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <skip>${proj.check.skip-spotbugs}</skip>
                    <failOnError>${proj.check.fail-spotbugs}</failOnError>
                    <effort>Max</effort>
                    <maxHeap>1024</maxHeap>
                    <omitVisitors>
                        FindRefComparison,
                        FindSelfComparison,
                        FindSelfComparison2,
                        ThrowingExceptions
                    </omitVisitors>
                </configuration>
                <executions>
                    <execution>
                        <id>proj.default</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <gpg.executable>gpg2</gpg.executable>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>${dep.plugin.release.version}</version>
                        <configuration>
                            <autoVersionSubmodules>true</autoVersionSubmodules>
                            <useReleaseProfile>false</useReleaseProfile>
                            <releaseProfiles>release</releaseProfiles>
                            <goals>deploy</goals>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${dep.plugin.source.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>${dep.plugin.javadoc.version}</version>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                        <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>${dep.plugin.gpg.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>install</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
