<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <name>Maven OSS</name>
  <description>Parent POM for Cosium Maven based OSS projects</description>
  <url>https://github.com/Cosium/maven-oss</url>

  <groupId>com.cosium.maven_oss</groupId>
  <artifactId>maven-oss</artifactId>
  <version>1.2</version>
  <packaging>pom</packaging>

  <properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
          <configuration>
            <parameters>true</parameters>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.0.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.5.0</version>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <failOnError>false</failOnError>
            <additionalOptions>-Xdoclint:none</additionalOptions>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.1.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.1.0</version>
          <configuration>
            <trimStackTrace>false</trimStackTrace>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <pushChanges>false</pushChanges>
            <localCheckout>true</localCheckout>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <useReleaseProfile>true</useReleaseProfile>
            <releaseProfiles>release</releaseProfiles>
            <goals>deploy</goals>
            <tagNameFormat>@{project.version}</tagNameFormat>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0</version>
          <executions>
            <execution>
              <id>enforce</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireUpperBoundDeps />
                  <bannedDependencies>
                    <excludes>
                      <!--
                       CVE-2021-44228 and CVE-2021-45046
                       Prevents "Remote code injection in Log4j".
                       https://github.com/advisories/GHSA-jfh8-c2jp-5v3q
                       -->
                      <exclude>org.apache.logging.log4j:log4j-core:(,2.16.0)</exclude>
                      <!-- Exclude javax dependencies to enforce jakarta namespace usage -->
                      <exclude>javax.*:*</exclude>
                      <exclude>org.apache.tomee:javaee-api</exclude>
                      <!-- Use org.eclipse.angus:angus-mail instead -->
                      <exclude>com.sun.mail:jakarta.mail</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>	      
    </pluginManagement>	    
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
          <pushChanges>false</pushChanges>
          <localCheckout>true</localCheckout>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>true</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <goals>deploy</goals>
          <tagNameFormat>@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.8</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
              <autoDropAfterRelease>true</autoDropAfterRelease>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <scm>
    <connection>scm:git:https://github.com/Cosium/maven-oss</connection>
    <developerConnection>scm:git:https://github.com/Cosium/maven-oss</developerConnection>
    <url>https://github.com/Cosium/maven-oss</url>
    <tag>1.2</tag>
  </scm>

  <organization>
    <name>Cosium</name>
    <url>https://www.cosium.com</url>
  </organization>

  <developers>
    <developer>
      <id>reda-alaoui</id>
      <name>Réda Housni Alaoui</name>
      <email>reda-alaoui@hey.com</email>
      <url>https://github.com/reda-alaoui</url>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>https://www.opensource.org/licenses/mit-license.php</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

</project>
