<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2013 The OSGL maven parent Project
  ~
  ~ The OSGL maven parent Project licenses this file to you under the Apache License,
  ~ version 2.0 (the "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at:
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  ~ License for the specific language governing permissions and limitations
  ~ under the License.  
  -->
<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>org.osgl</groupId>
  <artifactId>parent</artifactId>
  <packaging>pom</packaging>
  <version>2.0.0-BETA-1</version>

  <name>parent</name>
  <description>Parent POM.xml with commonly used pre-configured features for OSGL projects</description>
  <url>http://maven-parent.osgl.org/</url>
  <inceptionYear>2017</inceptionYear>

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

  <organization>
    <name>OSGL (Open Source General Library)</name>
    <url>http://osgl.org</url>
  </organization>

  <developers>
    <developer>
      <id>1</id>
      <name>Gelin Luo</name>
      <email>greenlaw110@gmail.com</email>
      <organization>osgl.org</organization>
      <organizationUrl>http://www.osgl.org</organizationUrl>
      <roles>
        <role>Architect</role>
        <role>Developer</role>
      </roles>
      <timezone>+10</timezone>
    </developer>
  </developers>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <scm.url>git@github.com:osglworks/maven-parent.git</scm.url>

    <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
    <maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
    <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
    <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>

    <buildnumber-maven-plugin.version>1.4</buildnumber-maven-plugin.version>
    <cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
    <errorpone-core.version>2.1.1</errorpone-core.version>
    <license-maven-plugin.version>1.13</license-maven-plugin.version>
    <markdown-doclet.version>1.4</markdown-doclet.version>
    <plexus-compiler-javac-errorprone.version>2.8.2</plexus-compiler-javac-errorprone.version>

    <junit.version>4.12</junit.version>
    <mockito.version>2.9.0</mockito.version>
    <slf4j-api.version>1.7.25</slf4j-api.version>

    <osgl-javadoc.css.url>https://github.com/osglworks/java-version/blob/master/src/etc/javadoc.css</osgl-javadoc.css.url>
  </properties>

  <issueManagement>
    <system>github</system>
    <url>https://github.com/osglworks/maven-parent/issues</url>
  </issueManagement>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <scm>
    <connection>scm:git:${scm.url}</connection>
    <developerConnection>scm:git:${scm.url}</developerConnection>
    <url>&gt;https://github.com/osglworks/maven-parent</url>
  </scm>

  <distributionManagement>
    <downloadUrl>https://oss.sonatype.org/content/groups/public</downloadUrl>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>${sonatypeOssDistMgmtSnapshotsUrl}</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Nexus Release Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <repositories>
    <repository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

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

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <compilerId>javac-with-errorprone</compilerId>
          <forceJavacCompilerUse>true</forceJavacCompilerUse>
          <source>7</source>
          <target>7</target>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-compiler-javac-errorprone</artifactId>
            <version>${plexus-compiler-javac-errorprone.version}</version>
          </dependency>
          <!-- override plexus-compiler-javac-errorprone's dependency on
               Error Prone with the latest version -->
          <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_core</artifactId>
            <version>${errorpone-core.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>${cobertura-maven-plugin.version}</version>
        <configuration>
          <formats>
            <format>html</format>
            <format>xml</format>
          </formats>
          <check />
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.17</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>8.1</version>
          </dependency>
        </dependencies>
        <configuration>
          <failOnViolation>true</failOnViolation>
          <configLocation>checkstyle.xml</configLocation>
          <encoding>UTF-8</encoding>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
        </configuration>
        <executions>
          <execution>
            <id>checkstyle</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>${license-maven-plugin.version}</version>
        <configuration>
          <licenseName>apache_v2</licenseName>
          <verbose>false</verbose>
        </configuration>
        <executions>
          <execution>
            <id>first</id>
            <goals>
              <goal>update-file-header</goal>
            </goals>
            <phase>process-sources</phase>
            <configuration>
              <roots>
                <root>src/main/java</root>
                <root>src/test</root>
              </roots>
              <excludes>
                <exclude>**/README</exclude>
                <exclude>src/test/resources/**</exclude>
                <exclude>src/main/resources/**</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>${buildnumber-maven-plugin.version}</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <shortRevisionLength>4</shortRevisionLength>
        </configuration>
      </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>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito.version}</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-api.version}</version>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-deploy-plugin</artifactId>
              <configuration>
                <skip>true</skip>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven-javadoc-plugin.version}</version>
            <configuration>
              <stylesheetfile>src/etc/javadoc.css</stylesheetfile>
              <doclet>ch.raffael.mddoclet.MarkdownDoclet</doclet>
              <docletArtifact>
                <groupId>ch.raffael.markdown-doclet</groupId>
                <artifactId>markdown-doclet</artifactId>
                <version>${markdown-doclet.version}</version>
              </docletArtifact>
              <useStandardDocletOptions>true</useStandardDocletOptions>
              <links>
                <link>http://junit.org/junit4/javadoc/latest/</link>
              </links>
            </configuration>
            <executions>
              <execution>
                <id>gen-javadoc</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>javadoc</goal>
                </goals>
              </execution>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <!-- @see http://www.sonatype.com/books/nexus-book/reference/staging-sect-deployment.html -->
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${nexus-staging-maven-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>sonatype-nexus-staging</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <description>${project.version}</description>
            </configuration>
            <executions>
              <execution>
                <id>deploy-to-sonatype</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                  <goal>release</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
