<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2020 Rob Spoor

  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.github.robtimus</groupId>
  <artifactId>robtimus-parent</artifactId>
  <version>1.11</version>
  <packaging>pom</packaging>

  <name>robtimus-parent</name>
  <description>Maven parent for com.github.robtimus projects</description>
  <url>https://github.com/robtimus/robtimus-parent/</url>
  <inceptionYear>2020</inceptionYear>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Rob Spoor</name>
      <email>robtimus@users.noreply.github.com</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:robtimus/robtimus-parent.git</connection>
    <developerConnection>scm:git:git@github.com:robtimus/robtimus-parent.git</developerConnection>
    <tag>1.11</tag>
    <url>https://github.com/robtimus/robtimus-parent</url>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/robtimus/robtimus-parent/issues</url>
  </issueManagement>

  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <version.java>1.8</version.java>

    <version.checkstyle>10.12.5</version.checkstyle>
    <version.checkstyle-extension>1.0</version.checkstyle-extension>
    <version.hamcrest>2.2</version.hamcrest>
    <version.junit>5.10.1</version.junit>
    <version.mockito>5.7.0</version.mockito>

    <version.plugin.antrun>3.1.0</version.plugin.antrun>
    <version.plugin.assembly>3.6.0</version.plugin.assembly>
    <version.plugin.checkstyle>3.3.1</version.plugin.checkstyle>
    <version.plugin.clean>3.3.2</version.plugin.clean>
    <version.plugin.compiler>3.11.0</version.plugin.compiler>
    <version.plugin.dependency>3.6.1</version.plugin.dependency>
    <version.plugin.deploy>3.1.1</version.plugin.deploy>
    <version.plugin.enforcer>3.4.1</version.plugin.enforcer>
    <version.plugin.gpg>3.1.0</version.plugin.gpg>
    <version.plugin.install>3.1.1</version.plugin.install>
    <version.plugin.jar>3.3.0</version.plugin.jar>
    <version.plugin.javadoc>3.6.2</version.plugin.javadoc>
    <version.plugin.project-info-reports>3.4.5</version.plugin.project-info-reports>
    <version.plugin.release>3.0.1</version.plugin.release>
    <version.plugin.resources>3.3.1</version.plugin.resources>
    <version.plugin.site>3.12.1</version.plugin.site>
    <version.plugin.source>3.3.0</version.plugin.source>
    <version.plugin.surefire>3.2.2</version.plugin.surefire>

    <version.plugin.build-helper>3.4.0</version.plugin.build-helper>
    <version.plugin.nexus-staging>1.6.13</version.plugin.nexus-staging>
    <version.plugin.i18n>3.0</version.plugin.i18n>
    <version.plugin.moditect>1.1.0</version.plugin.moditect>
    <version.plugin.robtimus-build-helper>1.1</version.plugin.robtimus-build-helper>
    <version.plugin.templating>3.0.0</version.plugin.templating>
    <version.plugin.versions>2.16.2</version.plugin.versions>

    <!-- Always define argLine so @{argLine} can always be used -->
    <argLine />
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${version.junit}</version>
      </dependency>

      <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest</artifactId>
        <version>${version.hamcrest}</version>
      </dependency>

      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${version.mockito}</version>
      </dependency>

      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-inline</artifactId>
        <version>${version.mockito}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${version.plugin.compiler}</version>
          <configuration>
            <source>${version.java}</source>
            <target>${version.java}</target>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>templating-maven-plugin</artifactId>
          <version>${version.plugin.templating}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${version.plugin.dependency}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${version.plugin.jar}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${version.plugin.source}</version>
          <executions>
            <execution>
              <phase>verify</phase>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${version.plugin.resources}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${version.plugin.checkstyle}</version>
          <configuration>
            <propertyExpansion>basedir=${project.basedir}</propertyExpansion>
            <configLocation>https://raw.githubusercontent.com/robtimus/robtimus-parent/master/checkstyle-v3.xml</configLocation>
            <includeResources>true</includeResources>
            <includeTestResources>true</includeTestResources>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
            <excludes>**/module-info.java</excludes>
            <violationSeverity>warning</violationSeverity>
            <failOnViolation>true</failOnViolation>
            <consoleOutput>true</consoleOutput>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${version.checkstyle}</version>
            </dependency>
            <dependency>
              <groupId>com.github.robtimus</groupId>
              <artifactId>checkstyle-extension</artifactId>
              <version>${version.checkstyle-extension}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <phase>validate</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${version.plugin.enforcer}</version>
          <executions>
            <execution>
              <id>enforce-maven-version</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>3.8.2</version>
                  </requireMavenVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${version.plugin.javadoc}</version>
          <configuration>
            <charset>UTF-8</charset>
            <docencoding>UTF-8</docencoding>
            <splitindex>true</splitindex>
            <author>true</author>
            <version>true</version>
            <notimestamp>true</notimestamp>
            <!--
                Tags based on https://github.com/openjdk/jdk/blob/master/make/Docs.gmk
                "version" added based on https://nipafx.dev/javadoc-tags-apiNote-implSpec-implNote/
            -->
            <tags>
              <tag>
                <name>apiNote</name>
                <placement>a</placement>
                <head>API Note:</head>
              </tag>
              <tag>
                <name>implSpec</name>
                <placement>a</placement>
                <head>Implementation Requirements:</head>
              </tag>
              <tag>
                <name>implNote</name>
                <placement>a</placement>
                <head>Implementation Note:</head>
              </tag>
              <tag>
                <name>author</name>
              </tag>
              <tag>
                <name>param</name>
              </tag>
              <tag>
                <name>return</name>
              </tag>
              <tag>
                <name>throws</name>
              </tag>
              <tag>
                <name>since</name>
              </tag>
              <tag>
                <name>version</name>
              </tag>
              <tag>
                <name>serialData</name>
              </tag>
              <tag>
                <name>factory</name>
              </tag>
              <tag>
                <name>spec</name>
              </tag>
              <tag>
                <name>see</name>
              </tag>
            </tags>
          </configuration>
          <executions>
            <execution>
              <phase>verify</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${version.plugin.build-helper}</version>
        </plugin>

        <plugin>
          <groupId>com.github.robtimus</groupId>
          <artifactId>i18n-maven-plugin</artifactId>
          <version>${version.plugin.i18n}</version>
        </plugin>

        <plugin>
          <groupId>org.moditect</groupId>
          <artifactId>moditect-maven-plugin</artifactId>
          <version>${version.plugin.moditect}</version>
          <executions>
            <execution>
              <id>add-module-info</id>
              <phase>package</phase>
              <goals>
                <goal>add-module-info</goal>
              </goals>
              <configuration>
                <overwriteExistingFiles>true</overwriteExistingFiles>
                <module>
                  <moduleInfoFile>${project.basedir}/src/moditect/module-info.java</moduleInfoFile>
                </module>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>com.github.robtimus</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${version.plugin.robtimus-build-helper}</version>
          <executions>
            <execution>
              <id>include-license</id>
              <goals>
                <goal>jar-license</goal>
                <goal>javadoc-license</goal>
              </goals>
            </execution>
            <execution>
              <id>copy-readme</id>
              <goals>
                <goal>site-index</goal>
              </goals>
              <configuration>
                <badgePatterns>
                  <badgePattern>https://github.com/.*/badge.svg</badgePattern>
                  <badgePattern>https://img.shields.io/.*?</badgePattern>
                  <badgePattern>https://badgen.net/.*</badgePattern>
                  <badgePattern>https://snyk.io/test/.*/badge.svg</badgePattern>
                  <badgePattern>https://sonarcloud.io/api/project_badges/.*</badgePattern>
                </badgePatterns>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>${version.plugin.antrun}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>${version.plugin.assembly}</version>
          <configuration>
            <attach>false</attach>
          </configuration>
          <executions>
            <execution>
              <phase>verify</phase>
              <goals>
                <goal>single</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${version.plugin.clean}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${version.plugin.surefire}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>${version.plugin.install}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${version.plugin.release}</version>
          <configuration>
            <tagNameFormat>@{project.version}</tagNameFormat>
            <useReleaseProfile>false</useReleaseProfile>
            <releaseProfiles>release</releaseProfiles>
            <goals>deploy</goals>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${version.plugin.gpg}</version>
          <executions>
            <execution>
              <phase>verify</phase>
              <goals>
                <goal>sign</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>${version.plugin.nexus-staging}</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-deploy-plugin</artifactId>
          <version>${version.plugin.deploy}</version>
          <executions>
            <execution>
              <phase>deploy</phase>
              <goals>
                <goal>deploy</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${version.plugin.site}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>${version.plugin.project-info-reports}</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>${version.plugin.versions}</version>
          <configuration>
            <rulesUri>https://raw.githubusercontent.com/robtimus/robtimus-parent/master/maven-version-rules.xml</rulesUri>
          </configuration>
        </plugin>

        <!-- this plugin is required to make Eclipse lifecycle errors disappear -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <versionRange>[1.0,)</versionRange>
                    <goals>
                      <goal>run</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <inherited>true</inherited>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <inherited>false</inherited>
        <configuration>
          <skipDeploy>true</skipDeploy>
        </configuration>
        <executions>
          <execution>
            <id>attach-descriptor</id>
            <goals>
              <goal>attach-descriptor</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <inherited>false</inherited>
      </plugin>

      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <inherited>false</inherited>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <inherited>false</inherited>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>${version.plugin.project-info-reports}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>summary</report>
              <report>dependency-info</report>
              <report>dependencies</report>
              <report>licenses</report>
              <report>team</report>
              <report>scm</report>
              <report>issue-management</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${version.plugin.javadoc}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>pre-java-11</id>

      <activation>
        <jdk>(,11)</jdk>
      </activation>

      <properties>
        <!-- Note: 10.0 and up require Java 11 -->
        <version.checkstyle>9.3</version.checkstyle>
        <!-- Note: 5.0.0 and up require Java 11 -->
        <version.mockito>4.11.0</version.mockito>
      </properties>
    </profile>
  </profiles>
</project>
