<?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.2</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.2</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>

        <junit.version>5.8.2</junit.version>
        <log4j2.version>2.17.2</log4j2.version>

        <pmd.version>6.47.0</pmd.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.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j2.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j2.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.36</version>
        </dependency>

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

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

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

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

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M7</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>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.1.0</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>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>4.7.0.0</version>
                <dependencies>
                    <dependency>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs</artifactId>
                        <version>4.7.0</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>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.17.0</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>${pmd.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>net.sourceforge.pmd</groupId>
                        <artifactId>pmd-java</artifactId>
                        <version>${pmd.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-checkstyle-plugin</artifactId>
                <version>3.1.2</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>10.3</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-compiler-plugin</artifactId>
                <version>3.10.1</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-jar-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</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>3.0.0-M6</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>3.2.1</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>3.4.0</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>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>install</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
