<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>io.metaloom</groupId>
  <artifactId>maven-parent</artifactId>
  <version>2.1.0</version>
  <packaging>pom</packaging>

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

    <!-- Dependency versions -->
    <junit4.version>4.13.2</junit4.version>
    <junit5.version>5.10.1</junit5.version>
    <mockito.version>1.10.19</mockito.version>
    <slf4j.version>1.7.36</slf4j.version>
    <logback.classic.version>1.2.12</logback.classic.version>

    <!-- Plugin versions -->
    <os-plugin.version>1.7.1</os-plugin.version>
    <jreleaser-plugin.version>1.4.0</jreleaser-plugin.version>
    <maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
    <maven.assembly.plugin.version>3.4.2</maven.assembly.plugin.version>
    <maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
    <maven.dependency.plugin.version>3.1.1</maven.dependency.plugin.version>
    <maven.surefire.plugin.version>3.2.2</maven.surefire.plugin.version>
    <maven.nexus.plugin.version>1.6.13</maven.nexus.plugin.version>
    <maven.failsafe.plugin.version>3.2.2</maven.failsafe.plugin.version>
    <maven.javadoc.plugin.version>3.5.0</maven.javadoc.plugin.version>
    <maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
    <maven.shade.plugin.version>3.4.1</maven.shade.plugin.version>
    <maven.jar.plugin.version>3.3.0</maven.jar.plugin.version>
    <maven.source.plugin.version>3.2.1</maven.source.plugin.version>
    <maven.site.plugin.version>3.3</maven.site.plugin.version>
    <maven.enforcer.plugin.version>3.2.1</maven.enforcer.plugin.version>
    <maven.build.helper.plugin.version>3.3.0</maven.build.helper.plugin.version>

    <!-- SCM / Deployment -->
    <project.github.repository>metaloom/maven-parent</project.github.repository>
    <nexus.url>https://s01.oss.sonatype.org</nexus.url>
  </properties>

  <!-- Meta -->
  <inceptionYear>2021</inceptionYear>
  <description>Parent POM for MetaLoom maven projects</description>
  <url>https://github.com/metaloom/maven-parent</url>
  <name>maven-parent</name>

  <scm>
    <connection>scm:git:git@github.com:metaloom/maven-parent.git</connection>
    <developerConnection>scm:git:git@github.com:metaloom/maven-parent.git</developerConnection>
    <url>https://github.com/metaloom/maven-parent</url>
    <tag>HEAD</tag>
  </scm>

  <developers>
    <developer>
      <id>jotschi</id>
      <name>Johannes Schüth</name>
      <roles>
        <role>Maintainer</role>
      </roles>
      <email>git@jotschi.de</email>
      <organization>MetaLoom</organization>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://spdx.org/licenses/Apache-2.0.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <profiles>
    <profile>
      <id>publication</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <attach>true</attach>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <attach>true</attach>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>remote-deploy</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <defaultGoal>deploy</defaultGoal>
        <plugins>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>gpg</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <keyname>${gpg.keyname}</keyname>
                  <passphraseServerId>${gpg.keyname}</passphraseServerId>
                  <gpgArguments>
                    <arg>--no-tty</arg>
                    <arg>--batch</arg>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>jreleaser</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jreleaser</groupId>
            <artifactId>jreleaser-maven-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>2.11.0</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <id>release</id>
                <phase>deploy</phase>
                <goals>
                  <goal>release</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <jreleaser>
                <release>
                  <github>
                    <tagName>v{{projectVersion}}</tagName>
                    <releaseName>v{{projectVersion}}</releaseName>
                    <overwrite>true</overwrite>
                    <changelog>
                      <formatted>ALWAYS</formatted>
                      <format>- {{commitShortHash}}
                        {{commitTitle}}</format>
                      <preset>conventional-commits</preset>
                      <contributors>
                        <format>- {{contributorName}}</format>
                      </contributors>
                      <hide>
                        <categories>merge</categories>
                        <contributors>GitHub,dependabot</contributors>
                      </hide>
                    </changelog>
                  </github>
                </release>
              </jreleaser>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit4.version}</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit5.version}</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-params</artifactId>
        <version>${junit5.version}</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.classic.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>${os-plugin.version}</version>
      </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.jreleaser</groupId>
          <artifactId>jreleaser-maven-plugin</artifactId>
          <version>${jreleaser-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven.enforcer.plugin.version}</version>
          <executions>
            <execution>
              <?m2e ignore?>
              <id>enforce-versions</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>3.8.6</version>
                  </requireMavenVersion>
                  <requireJavaVersion>
                    <version>17</version>
                  </requireJavaVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven.failsafe.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven.surefire.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven.javadoc.plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven.jar.plugin.version}</version>
          <configuration>
            <archive>
              <manifestEntries>
                <Build-Jdk>${java.version} (${java.vendor} ${java.vm.version})</Build-Jdk>
                <Build-Timestamp>${git.build.time}</Build-Timestamp>
                <Build-Revision>${git.commit.id}</Build-Revision>
                <Build-OS>${os.name} ${os.arch} ${os.version}</Build-OS>
              </manifestEntries>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>

        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>${maven.shade.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven.compiler.plugin.version}</version>
          <configuration>
            <release>17</release>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${maven.site.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${maven.resources.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven.dependency.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>${maven.nexus.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${maven.build.helper.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven.gpg.plugin.version}</version>
        </plugin>
        <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</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <site>
      <id>github</id>
      <url>scm:git:ssh://git@github.com/${project.github.repository}.git</url>
    </site>
  </distributionManagement>
</project>
