<?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.2</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>http://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>

  <prerequisites>
    <maven>3.6</maven>
  </prerequisites>

  <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.2</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://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>

    <version.java>1.8</version.java>

    <version.checkstyle>8.36.2</version.checkstyle>
    <version.hamcrest>2.2</version.hamcrest>
    <version.junit>5.7.0</version.junit>
    <version.mockito>3.5.13</version.mockito>
    <version.slf4j>1.7.30</version.slf4j>

    <version.plugin.antrun>3.0.0</version.plugin.antrun>
    <version.plugin.assembly>3.3.0</version.plugin.assembly>
    <version.plugin.build-helper>3.1.0</version.plugin.build-helper>
    <version.plugin.checkstyle>3.1.1</version.plugin.checkstyle>
    <version.plugin.clean>3.1.0</version.plugin.clean>
    <version.plugin.compiler>3.8.1</version.plugin.compiler>
    <version.plugin.dependency>3.1.2</version.plugin.dependency>
    <version.plugin.deploy>2.8.2</version.plugin.deploy>
    <version.plugin.gpg>1.6</version.plugin.gpg>
    <version.plugin.nexus-staging>1.6.8</version.plugin.nexus-staging>
    <version.plugin.i18n>1.0</version.plugin.i18n>
    <version.plugin.info-reports>3.0.0</version.plugin.info-reports>
    <version.plugin.install>2.5.2</version.plugin.install>
    <version.plugin.jar>3.2.0</version.plugin.jar>
    <version.plugin.javadoc>3.2.0</version.plugin.javadoc>
    <version.plugin.moditect>1.0.0.RC1</version.plugin.moditect>
    <version.plugin.release>2.5.3</version.plugin.release>
    <version.plugin.resources>3.1.0</version.plugin.resources>
    <version.plugin.site>3.7.1</version.plugin.site>
    <version.plugin.source>3.2.1</version.plugin.source>
    <version.plugin.surefire>2.22.2</version.plugin.surefire>
    <version.plugin.templating>1.0.0</version.plugin.templating>
    <version.plugin.versions>2.7</version.plugin.versions>

    <robtimus.site-index.generate>true</robtimus.site-index.generate>
    <robtimus.site-index.title>Overview</robtimus.site-index.title>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${version.slf4j}</version>
      </dependency>

      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-nop</artifactId>
        <version>${version.slf4j}</version>
      </dependency>

      <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>
    </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.xml</configLocation>
            <includeResources>true</includeResources>
            <includeTestResource>true</includeTestResource>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
            <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>
          </dependencies>
          <executions>
            <execution>
              <phase>validate</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </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>
          </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>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>${version.plugin.antrun}</version>
          <executions>
            <execution>
              <id>copy-license</id>
              <phase>generate-sources</phase>
              <goals>
                <goal>run</goal>
              </goals>
              <configuration>
                <target>
                  <copy todir="${project.build.directory}/apidocs/META-INF">
                    <fileset dir="${project.basedir}">
                      <include name="LICENSE.txt" />
                    </fileset>
                  </copy>
                </target>
              </configuration>
            </execution>
            <execution>
              <id>copy-readme</id>
              <phase>pre-site</phase>
              <goals>
                <goal>run</goal>
              </goals>
              <configuration>
                <target if="${robtimus.site-index.generate}">
                  <concat destfile="${project.basedir}/src/site/markdown/index.md">
                    <string xml:space="preserve"><![CDATA[<head>
  <title>${robtimus.site-index.title}</title>
</head>

]]></string>
                    <fileset file="${project.basedir}/README.md" />
                  </concat>
                  <replaceregexp file="${project.basedir}/src/site/markdown/index.md" match="${project.url}" replace="" flags="g" />
                </target>
              </configuration>
            </execution>
          </executions>
        </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://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.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-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.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>
</project>
