<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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>team.yi.maven.plugin</groupId>
  <artifactId>maven-semantic-gitlog</artifactId>
  <version>0.21.0</version>
  <packaging>maven-plugin</packaging>
  <inceptionYear>2020</inceptionYear>

  <name>maven-semantic-gitlog</name>
  <description>A simple `Semantic Versioning` management tool based on `Conventional Commits`.</description>
  <url>https://github.com/ymind/maven-semantic-gitlog</url>

  <organization>
    <name>Yi.Team</name>
    <url>https://yi.team/</url>
  </organization>

  <developers>
    <developer>
      <name>ymind</name>
      <email>ymind@yi.team</email>
      <url>https://yi.team/</url>
      <organization>Yi.Team</organization>
      <organizationUrl>https://yi.team/</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:ymind/maven-semantic-gitlog.git</connection>
    <developerConnection>scm:git:git@github.com:ymind/maven-semantic-gitlog.git</developerConnection>
    <url>https://github.com/ymind/maven-semantic-gitlog</url>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/ymind/maven-semantic-gitlog/issues</url>
  </issueManagement>

  <ciManagement>
    <system>Travis-CI</system>
    <url>https://travis-ci.org/ymind/maven-semantic-gitlog</url>
  </ciManagement>

  <licenses>
    <license>
      <name>MIT</name>
      <url>https://opensource.org/licenses/MIT</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <checkstyle.skip>false</checkstyle.skip>
    <pmd.skip>false</pmd.skip>
    <pmdVersion>6.22.0</pmdVersion>
    <junit.jupiter.version>5.6.1</junit.jupiter.version>
  </properties>

  <dependencies>
    <!-- https://mvnrepository.com/artifact/org.apache.maven/maven-core -->
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>3.6.3</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api -->
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>3.6.3</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugin-tools/maven-plugin-annotations -->
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.6.0</version>
      <scope>provided</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.12</version>
      <scope>provided</scope>
    </dependency>

    <!-- https://github.com/ymind/semantic-gitlog -->
    <dependency>
      <groupId>team.yi.tools</groupId>
      <artifactId>semantic-gitlog</artifactId>
      <version>0.5.0</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>8</source>
          <target>8</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>2.7</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.6.0</version>
        <configuration>
          <goalPrefix>semantic-gitlog</goalPrefix>
          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
        </configuration>
        <executions>
          <execution>
            <id>mojo-descriptor</id>
            <phase>process-classes</phase>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <configLocation>${project.basedir}/config/checkstyle/checkstyle.xml</configLocation>
          <skip>${checkstyle.skip}</skip>
          <consoleOutput>true</consoleOutput>
          <enableRSS>false</enableRSS>
          <failOnViolation>true</failOnViolation>
          <failsOnError>true</failsOnError>
        </configuration>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>checkstyle</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>8.30</version>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.12.0</version>
        <configuration>
          <rulesets>
            <ruleset>${project.basedir}/config/pmd/rulesets.xml</ruleset>
          </rulesets>
          <skip>${pmd.skip}</skip>
          <skipPmdError>false</skipPmdError>
          <skipEmptyReport>false</skipEmptyReport>
          <failOnViolation>true</failOnViolation>
          <printFailingErrors>true</printFailingErrors>
          <includeTests>true</includeTests>
        </configuration>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>pmd</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>net.sourceforge.pmd</groupId>
            <artifactId>pmd-core</artifactId>
            <version>${pmdVersion}</version>
          </dependency>
          <dependency>
            <groupId>net.sourceforge.pmd</groupId>
            <artifactId>pmd-java</artifactId>
            <version>${pmdVersion}</version>
          </dependency>
          <dependency>
            <groupId>net.sourceforge.pmd</groupId>
            <artifactId>pmd-javascript</artifactId>
            <version>${pmdVersion}</version>
          </dependency>
          <dependency>
            <groupId>net.sourceforge.pmd</groupId>
            <artifactId>pmd-jsp</artifactId>
            <version>${pmdVersion}</version>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.1.1</version>
        <configuration>
          <charset>${project.build.sourceEncoding}</charset>
          <docencoding>${project.build.sourceEncoding}</docencoding>
          <encoding>${project.build.sourceEncoding}</encoding>
          <quiet>true</quiet>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.2.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-site-plugin</artifactId>
        <version>3.8.2</version>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>3.0.0</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.0.0</version>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>mvn-release</id>

      <properties>
        <gitlog.toRef>dev</gitlog.toRef>
        <gitlog.forceNextVersion>true</gitlog.forceNextVersion>
        <gitlog.preRelease>SNAPSHOT</gitlog.preRelease>
      </properties>

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

      <pluginRepositories>
        <pluginRepository>
          <id>ossrh</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </pluginRepository>
      </pluginRepositories>

      <build>
        <plugins>
          <plugin>
            <groupId>team.yi.maven.plugin</groupId>
            <artifactId>maven-semantic-gitlog</artifactId>
            <version>0.21.0</version>
            <configuration>
              <fileSets>
                <fileSet>
                  <target>${project.basedir}/CHANGELOG.md</target>
                  <template>${project.basedir}/config/gitlog/CHANGELOG.md.mustache</template>
                </fileSet>
                <fileSet>
                  <target>${project.basedir}/CHANGELOG.zh-cn.md</target>
                  <template>${project.basedir}/config/gitlog/CHANGELOG.zh-cn.md.mustache</template>
                </fileSet>
              </fileSets>

              <updateProjectVersion>false</updateProjectVersion>
              <isUnstable>true</isUnstable>
              <forceNextVersion>${gitlog.forceNextVersion}</forceNextVersion>

              <jsonFile>${project.basedir}/CHANGELOG.json</jsonFile>

              <issueUrlTemplate>${project.scm.url}/issues/:issueId</issueUrlTemplate>
              <commitUrlTemplate>${project.scm.url}/commit/:commitId</commitUrlTemplate>
              <mentionUrlTemplate>https://github.com/:username</mentionUrlTemplate>

              <derivedVersionMark>NEXT_VERSION:==</derivedVersionMark>

              <preRelease>${gitlog.preRelease}</preRelease>

              <commitLocales>
                <en>${project.basedir}/config/gitlog/commit-locales.md</en>
                <zh-cn>${project.basedir}/config/gitlog/commit-locales.zh-cn.md</zh-cn>
              </commitLocales>
              <scopeProfiles>
                <en>${project.basedir}/config/gitlog/commit-scopes.md</en>
                <zh-cn>${project.basedir}/config/gitlog/commit-scopes.zh-cn.md</zh-cn>
              </scopeProfiles>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</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>1.6.8</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>false</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
