<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>tech.iooo.coco</groupId>
  <artifactId>iooo-distribution-config</artifactId>
  <version>1.0.7</version>
  <packaging>pom</packaging>

  <name>iooo-distribution-config</name>
  <description>distribution config</description>
  <url>https://www.iooo.tech</url>

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

  <scm>
    <url>https://github.com/Ivan97/iooo-distribution-config</url>
  </scm>

  <developers>
    <developer>
      <id>Ivan97</id>
      <name>Yangki Zhang</name>
      <email>YangkiZhang@gmail.com</email>
      <roles>
        <role>developer</role>
      </roles>
      <timezone>+8</timezone>
      <url>https://www.iooo.tech</url>
    </developer>
  </developers>

  <properties>
    <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
    <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
    <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
    <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
    <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
    <maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
    <sonar-maven-plugin.version>3.5.0.1254</sonar-maven-plugin.version>
    <git-commit-id-plugin.version>2.2.5</git-commit-id-plugin.version>
    <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
    <deploy.skip>false</deploy.skip>
    <arguments/>
  </properties>

  <profiles>
    <profile>
      <id>iooo-deploy</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <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>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <additionalOptions>
                    <additionalOption>${javadoc.opts}</additionalOption>
                  </additionalOptions>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <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>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${nexus-staging-maven-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>oss</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
              <skipNexusStagingDeployMojo>${deploy.skip}</skipNexusStagingDeployMojo>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>${maven-deploy-plugin.version}</version>
            <configuration>
              <skip>${deploy.skip}</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>java8-doclint-disabled</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <properties>
        <javadoc.opts>-Xdoclint:none</javadoc.opts>
      </properties>
    </profile>
    <profile>
      <id>snapshot</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <version.suffix><![CDATA[^.*(-SNAPSHOT)$]]></version.suffix>
      </properties>
    </profile>
    <profile>
      <id>release</id>
      <properties>
        <!--<version.suffix><![CDATA[^.*(\.RELEASE)$]]></version.suffix>-->
        <version.suffix><![CDATA[^.*(?<!-SNAPSHOT)$]]></version.suffix>
      </properties>
    </profile>
  </profiles>

  <repositories>
    <repository>
      <id>sonatype-nexus</id>
      <name>sonatype-nexus</name>
      <url>https://oss.sonatype.org/content/groups/staging</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>
  <distributionManagement>
    <snapshotRepository>
      <id>oss</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>oss</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
      <uniqueVersion>true</uniqueVersion>
    </repository>
  </distributionManagement>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>
    <pluginManagement>
      <plugins>
        <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>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>${sonar-maven-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin.version}</version>
          <configuration>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <useReleaseProfile>false</useReleaseProfile>
            <arguments>${arguments} -Piooo-release,java8-doclint-disabled</arguments>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven-enforcer-plugin.version}</version>
          <executions>
            <execution>
              <id>enforce-maven</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version>
                    <message>Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums
                      respectively.
                    </message>
                  </requireMavenVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <version>${git-commit-id-plugin.version}</version>
        <executions>
          <execution>
            <id>get-the-git-infos</id>
            <goals>
              <goal>revision</goal>
            </goals>
          </execution>
          <execution>
            <id>validate-the-git-infos</id>
            <!-- *NOTE*: The default phase of validateRevision is verify, but in case you want to change it, you can do so by adding the phase here -->
            <phase>deploy</phase>
            <goals>
              <goal>validateRevision</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
          <dateFormat>yyyy-MM-dd @ HH:mm:ss Z</dateFormat>
          <failOnNoGitDirectory>false</failOnNoGitDirectory>
          <runOnlyOnce>false</runOnlyOnce>
          <generateGitPropertiesFile>true</generateGitPropertiesFile>
          <injectAllReactorProjects>true</injectAllReactorProjects>
          <skipPoms>false</skipPoms>
          <!-- more config here as you see fit -->
          <validationProperties>
            <validationProperty>
              <name>validating project version</name>
              <value>${project.version}</value>
              <shouldMatchTo>${version.suffix}</shouldMatchTo>
            </validationProperty>
            <validationProperty>
              <name>validating git dirty</name>
              <value>${git.dirty}</value>
              <shouldMatchTo>false</shouldMatchTo>
            </validationProperty>
          </validationProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
