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

  <groupId>com.zonzonzon</groupId>
  <artifactId>common</artifactId>
  <version>1.13</version>
  <packaging>pom</packaging>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>Root</description>
  <url>http://zonzonzon.com</url>

  <developers>
    <developer>
      <email>zoninap@gmail.com</email>
      <name>Andrey Zonin</name>
      <url>http://zonzonzon.com</url>
      <id>zoninap</id>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <ossrh-snapshots-repository.url>https://s01.oss.sonatype.org/content/repositories/snapshots/</ossrh-snapshots-repository.url>
    <ossrh-staging-repository.url>https://s01.oss.sonatype.org/content/groups/staging/</ossrh-staging-repository.url>
    <ossrh-releases-repository.url>https://s01.oss.sonatype.org/content/repositories/releases/</ossrh-releases-repository.url>
    <ossrh-public-repository.url>https://s01.oss.sonatype.org/content/groups/public/</ossrh-public-repository.url>
    <sonatype-nexus-url>https://s01.oss.sonatype.org/</sonatype-nexus-url>
    <java.version>11</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
    <maven-source-plugin.version>3.0.0</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.0.0</maven-javadoc-plugin.version>
    <maven-deploy-plugin.version>3.0.0</maven-deploy-plugin.version>
  </properties>

  <!-- Repositories to deploy current project  -->
  <distributionManagement>
    <snapshotRepository>
      <id>maven-snapshots</id>
      <name>OSSRH Maven Repository to Deploy Snapshots</name>
      <url>${ossrh-snapshots-repository.url}</url>
    </snapshotRepository>
<!--    <repository>-->
<!--      <id>maven-staging</id>-->
<!--      <name>OSSRH Maven Repository to Deploy to Staging</name>-->
<!--      <url>${ossrh-staging-repository.url}</url>-->
<!--    </repository>-->
    <repository>
      <id>maven-releases</id>
      <name>OSSRH Maven Repository to Deploy Releases</name>
      <url>${ossrh-releases-repository.url}</url>
    </repository>
  </distributionManagement>
  <repositories>
    <repository>
      <id>maven-public</id>
      <name>OSSRH Maven Repository to Import</name>
      <url>${ossrh-public-repository.url}</url>
    </repository>
  </repositories>
  <scm>
    <connection>scm:git:git@gitlab.com:ZonZonZon/common.git</connection>
    <developerConnection>scm:git:git@gitlab.com:ZonZonZon/common.git</developerConnection>
    <url>http://zonzonzon.com</url>
    <tag>common-1.13</tag>
  </scm>

  <!-- Dependent layer-modules-->
  <modules>
    <module>common-java-shared-kernel</module>
    <module>common-spring-shared-kernel</module>
    <module>common-spring-reactive-shared-kernel</module>
    <module>common-java-advanced-shared-kernel</module>
    <module>common-java-ddd-shared-kernel</module>
  </modules>

  <!-- No common libraries - modules are setup independently-->

  <!-- Plugins-->
  <build>
    <finalName>${project.artifactId}_${project.version}</finalName>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>2.6.3</version>
        <configuration>
          <excludes>
            <exclude>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-configuration-processor</artifactId>
            </exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
          <release>${java.version}</release>
          <generatedSourcesDirectory>${project.build.directory}/generated-sources
          </generatedSourcesDirectory>
        </configuration>
      </plugin>

      <!-- To Release to the Public Maven Repository -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.0.0-M4</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>true</useReleaseProfile>
          <releaseProfiles>releaseProfile</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.8</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>maven-staging</serverId>
          <nexusUrl>${sonatype-nexus-url}</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- To publish library with sources and javadocs-->
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <version>${maven-source-plugin.version}</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>compile</phase>
            <goals><goal>jar-no-fork</goal></goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven-javadoc-plugin.version}</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <phase>compile</phase>
            <goals><goal>jar</goal></goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!-- Explicitly define maven-deploy-plugin after other to force exec order -->
        <artifactId>maven-deploy-plugin</artifactId>
        <version>${maven-deploy-plugin.version}</version>
        <executions>
          <execution>
            <id>deploy</id>
            <phase>compile</phase>
            <goals><goal>deploy</goal></goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
