<?xml version="1.0" encoding="UTF-8"?>
<!--

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) 2023, Wilddiary.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.

-->
<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>com.wilddiary</groupId>
  <artifactId>maven-base-starter</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>
  <name>Maven base starter parent</name>
  <description>Inheritable maven base starter for Java projects for faster bootstrapping with standard build \
    experience.</description>
  <url>https://github.com/Wilddiary/maven-base-starter</url>
  <organization>
    <name>Wilddiary.com</name>
  </organization>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>Dr0na</id>
      <name>Dr0na</name>
      <email>idrona@yahoo.com</email>
      <organization>Wilddiary.com</organization>
      <organizationUrl>https://wilddiary.com</organizationUrl>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:git://github.com/Wilddiary/maven-base-starter.git</connection>
    <developerConnection>scm:git:ssh://github.com/Wilddiary/maven-base-starter.git</developerConnection>
    <tag>1.0.0</tag>
    <url>https://github.com/Wilddiary/maven-base-starter/tree/main</url>
  </scm>
  <issueManagement>
    <system>Github</system>
    <url>https://github.com/Wilddiary/maven-base-starter/issues</url>
  </issueManagement>
  <!-- Distribution details applicable to this project -->
  <distributionManagement>
    <repository>
      <id>sonatype-nexus-repo</id>
      <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
      <id>sonatype-nexus-repo</id>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>
  <properties>
    <minimum-required-maven.version>3.6.3</minimum-required-maven.version>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <java.version>11</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <lombok.version>1.18.26</lombok.version>
    <lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
    <delombok.output>target/lombok-generated</delombok.output>
    <owasp-dependency-check.version>8.2.1</owasp-dependency-check.version>
    <dependency-check.skip>false</dependency-check.skip>
    <junit.jupiter.version>5.9.2</junit.jupiter.version>
    <sure-fire-plugin.version>3.0.0-M9</sure-fire-plugin.version>
    <surefire-junit5-tree-reporter.version>1.1.0</surefire-junit5-tree-reporter.version>
    <jacoco.skip>false</jacoco.skip>
    <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
    <jacoco-min-coverage.ratio>0.80</jacoco-min-coverage.ratio>
    <jacoco-missed-classes.count>0</jacoco-missed-classes.count>
    <checkstyle-plugin.version>3.2.1</checkstyle-plugin.version>
    <checkstyle.version>10.8.1</checkstyle.version>
    <checkstyle.skip>false</checkstyle.skip>
    <checkstyle.maxAllowedViolations>0</checkstyle.maxAllowedViolations>
    <checkstyle.violationSeverity>error</checkstyle.violationSeverity>
    <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
    <checkstyle.consoleOutput>true</checkstyle.consoleOutput>
    <release-commit-prefix>[skip ci]</release-commit-prefix>
    <maven-release-plugin.version>3.0.0-M7</maven-release-plugin.version>
    <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
    <maven-enforcer-plugin.version>3.2.1</maven-enforcer-plugin.version>
    <maven-versions-plugin.version>2.15.0</maven-versions-plugin.version>
    <maven-sortpom-plugin.version>3.2.1</maven-sortpom-plugin.version>
    <fmt-maven-plugin.version>2.19</fmt-maven-plugin.version>
    <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
    <gpg.skip>false</gpg.skip>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.jupiter.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-suite</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <id>central</id>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
  </repositories>
  <build>
    <pluginManagement>
      <plugins>
        <!-- format code -->
        <plugin>
          <groupId>com.spotify.fmt</groupId>
          <artifactId>fmt-maven-plugin</artifactId>
          <version>${fmt-maven-plugin.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
              <phase>validate</phase>
            </execution>
          </executions>
        </plugin>
        <!-- sort pom -->
        <plugin>
          <groupId>com.github.ekryd.sortpom</groupId>
          <artifactId>sortpom-maven-plugin</artifactId>
          <version>${maven-sortpom-plugin.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>verify</goal>
              </goals>
              <phase>verify</phase>
            </execution>
          </executions>
        </plugin>
        <!-- SCA -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${checkstyle-plugin.version}</version>
          <configuration>
            <configLocation>google_checks.xml</configLocation>
            <linkXRef>true</linkXRef>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${checkstyle.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>validate</id>
              <goals>
                <goal>check</goal>
              </goals>
              <phase>validate</phase>
            </execution>
          </executions>
        </plugin>
        <!-- dependencies vulnerability scan -->
        <plugin>
          <groupId>org.owasp</groupId>
          <artifactId>dependency-check-maven</artifactId>
          <version>${owasp-dependency-check.version}</version>
          <configuration>
            <versionCheckEnabled>true</versionCheckEnabled>
            <skipProvidedScope>true</skipProvidedScope>
            <skipRuntimeScope>true</skipRuntimeScope>
            <skipTestScope>true</skipTestScope>
            <formats>ALL</formats>
            <prettyPrint>true</prettyPrint>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <!-- code coverage -->
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${jacoco-maven-plugin.version}</version>
          <executions>
            <execution>
              <id>default-prepare-agent</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
            <execution>
              <id>jacoco-report</id>
              <goals>
                <goal>report</goal>
              </goals>
              <phase>test</phase>
              <configuration>
                <outputDirectory>target/jacoco-report</outputDirectory>
              </configuration>
            </execution>
            <!-- Define rule for successful build based on code coverage
                          criteria -->
            <execution>
              <id>jacoco-check</id>
              <goals>
                <goal>check</goal>
              </goals>
              <phase>test</phase>
              <configuration>
                <rules>
                  <rule>
                    <!-- When code coverage is 85% and no class missed then
                                          consider it as a successful build -->
                    <element>PACKAGE</element>
                    <limits>
                      <limit>
                        <counter>LINE</counter>
                        <value>COVEREDRATIO</value>
                        <minimum>${jacoco-min-coverage.ratio}</minimum>
                      </limit>
                      <limit>
                        <counter>CLASS</counter>
                        <value>MISSEDCOUNT</value>
                        <maximum>${jacoco-missed-classes.count}</maximum>
                      </limit>
                    </limits>
                  </rule>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <!-- package sources -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <!-- generating javadocs -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <sourcepath>${delombok.output}</sourcepath>
            <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>${maven-gpg-plugin.version}</version>
          <configuration>
            <gpgArguments>
              <arg>--pinentry-mode</arg>
              <arg>loopback</arg>
            </gpgArguments>
          </configuration>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <goals>
                <goal>sign</goal>
              </goals>
              <phase>verify</phase>
            </execution>
          </executions>
        </plugin>
        <!-- release plugin -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin.version}</version>
          <configuration>
            <scmCommentPrefix>${release-commit-prefix}</scmCommentPrefix>
            <!-- Ensure the bot's release commits don't trigger further pipeline runs -->
            <tagNameFormat>@{project.version}</tagNameFormat>
            <!-- Remove artifactId from the tag -->
          </configuration>
        </plugin>
        <!-- persist auto-generated sources -->
        <plugin>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok-maven-plugin</artifactId>
          <version>${lombok-maven-plugin.version}</version>
          <configuration>
            <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
            <outputDirectory>${delombok.output}</outputDirectory>
            <addOutputDirectory>false</addOutputDirectory>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>delombok</goal>
              </goals>
              <phase>generate-sources</phase>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${sure-fire-plugin.version}</version>
          <configuration>
            <reportFormat>plain</reportFormat>
            <statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter" />
          </configuration>
          <dependencies>
            <dependency>
              <groupId>me.fabriciorby</groupId>
              <artifactId>maven-surefire-junit5-tree-reporter</artifactId>
              <version>${surefire-junit5-tree-reporter.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven-enforcer-plugin.version}</version>
          <executions>
            <execution>
              <id>enforce-versions</id>
              <goals>
                <goal>enforce</goal>
                <goal>display-info</goal>
              </goals>
              <phase>validate</phase>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>${minimum-required-maven.version}</version>
                  </requireMavenVersion>
                  <requireJavaVersion>
                    <version>${java.version}</version>
                  </requireJavaVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <!-- Check updates for dependencies -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>${maven-versions-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>com.spotify.fmt</groupId>
        <artifactId>fmt-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
      </plugin>
      <plugin>
        <groupId>com.github.ekryd.sortpom</groupId>
        <artifactId>sortpom-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven-javadoc-plugin.version}</version>
        <configuration>
          <doclint>none</doclint>
        </configuration>
      </plugin>
    </plugins>
  </reporting>
</project>
