<?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>

  <groupId>com.ycourlee.oss</groupId>
  <artifactId>oss-parent</artifactId>
  <version>2</version>
  <packaging>pom</packaging>
  <name>oss parent</name>
  <description>Ycourlee Oss parent</description>
  <properties>
    <doc.name>README</doc.name>
    <main.basedir>${project.basedir}</main.basedir>
    <java.version>1.8</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <asciidoctor.maven.plugin.version>2.2.1</asciidoctor.maven.plugin.version>
    <asciidoctorj.pdf.version>1.6.0</asciidoctorj.pdf.version>
    <asciidoctorj.version>2.5.2</asciidoctorj.version>
    <flatten-maven-plugin.version>1.1.0</flatten-maven-plugin.version>
    <jacoco.version>0.8.7</jacoco.version>
    <jruby.version>9.2.17.0</jruby.version>
    <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
    <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
    <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
    <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
    <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
    <maven-source-plugin.version>3.1.0</maven-source-plugin.version>
    <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
    <versions-maven-plugin.version>2.7</versions-maven-plugin.version>
  </properties>
  <url>https://github.com/yalden/oss-parent</url>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <url>http://github.com/yalden/oss-parent</url>
    <connection>scm:git:git://github.com/yalden/oss-parent.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/yalden/oss-parent.git</developerConnection>
  </scm>
  <developers>
    <developer>
      <id>yalden</id>
      <email>ycourlee@qq.com</email>
      <roles>
        <role>author</role>
        <role>developer</role>
      </roles>
    </developer>
  </developers>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
          <parameters>true</parameters>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven-gpg-plugin.version}</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <phase>verify</phase>
              <goals>
                <goal>sign</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.asciidoctor</groupId>
          <artifactId>asciidoctor-maven-plugin</artifactId>
          <version>${asciidoctor.maven.plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.asciidoctor</groupId>
              <artifactId>asciidoctorj-pdf</artifactId>
              <version>${asciidoctorj.pdf.version}</version>
            </dependency>
            <!-- Comment this section to use the default jruby artifact provided by the plugin -->
            <dependency>
              <groupId>org.jruby</groupId>
              <artifactId>jruby-complete</artifactId>
              <version>${jruby.version}</version>
            </dependency>
            <!-- Comment this section to use the default AsciidoctorJ artifact provided by the plugin -->
            <dependency>
              <groupId>org.asciidoctor</groupId>
              <artifactId>asciidoctorj</artifactId>
              <version>${asciidoctorj.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <sourceDocumentName>${doc.name}.adoc</sourceDocumentName>
            <attributes>
              <icons>font</icons>
            </attributes>
          </configuration>
          <executions>
            <execution>
              <id>output-html</id>
              <phase>generate-resources</phase>
              <goals>
                <goal>process-asciidoc</goal>
              </goals>
              <configuration>
                <backend>html</backend>
                <attributes>
                  <source-highlighter>coderay</source-highlighter>
                </attributes>
              </configuration>
            </execution>
            <execution>
              <id>generate-pdf-doc-custom-theme</id>
              <phase>generate-resources</phase>
              <goals>
                <goal>process-asciidoc</goal>
              </goals>
              <configuration>
                <backend>pdf</backend>
                <!-- Use `book` docType to enable title page generation -->
                <doctype>book</doctype>
                <attributes>
                  <source-highlighter>coderay</source-highlighter>
                  <!-- Need copy them to project -->
                  <pdf-stylesdir>${main.basedir}/src/theme</pdf-stylesdir>
                  <pdf-fontsdir>${main.basedir}/src/theme/fonts</pdf-fontsdir>
                  <pdf-style>custom</pdf-style>
                  <icons>font</icons>
                  <pagenums/>
                  <toc/>
                  <idprefix/>
                  <idseparator>-</idseparator>
                </attributes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>flatten-maven-plugin</artifactId>
          <version>${flatten-maven-plugin.version}</version>
          <executions>
            <execution>
              <id>flatten</id>
              <phase>process-resources</phase>
              <goals>
                <goal>flatten</goal>
              </goals>
              <configuration>
                <updatePomFile>true</updatePomFile>
                <flattenMode>oss</flattenMode>
                <outputDirectory>${project.build.directory}/flatten-pom</outputDirectory>
                <flattenedPomFilename>${project.artifactId}-${project.version}.xml</flattenedPomFilename>
              </configuration>
            </execution>
            <execution>
              <id>flatten-clean</id>
              <phase>clean</phase>
              <goals>
                <goal>clean</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${jacoco.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <tags>
              <tag>
                <name>date</name>
                <placement>t</placement>
                <head>Created on:</head>
              </tag>
            </tags>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin.version}</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <useReleaseProfile>false</useReleaseProfile>
            <releaseProfiles>release</releaseProfiles>
            <goals>deploy</goals>
          </configuration>
        </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-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <phase>package</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>${versions-maven-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
      <distributionManagement>
        <repository>
          <id>ossrh</id>
          <url>https://s01.oss.sonatype.org/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
          <id>ossrh</id>
          <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
      </distributionManagement>
    </profile>
    <profile>
      <id>version</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <!-- Repo or Mirror -->
  <repositories>
    <repository>
      <id>public</id>
      <name>aliyun nexus</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <layout>default</layout>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>sonatype-repo-s</id>
      <name>Sonatype Repository</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </repository>
  </repositories>
</project>
