<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.github.xgp</groupId>
  <artifactId>oss-parent</artifactId>
  <packaging>pom</packaging>
  <version>0.7</version>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>Parent pom for oss projects</description>
  <url>https://github.com/xgp/oss-parent</url>

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

  <developers>
    <developer>
      <name>Garth</name>
      <url>https://github.com/xgp</url>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/xgp/oss-parent</url>
    <connection>scm:git:git@github.com:xgp/oss-parent.git</connection>
    <tag>v0.7</tag>
  </scm>
  
  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <name>Sonatype OSS Snapshots Repository</name>
      <url>${ossrh.url}/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <name>Sonatype OSS Release Staging Repository</name>
      <url>${ossrh.url}/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>
  
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.test.skip>false</maven.test.skip>
    <maven.integration.skip>true</maven.integration.skip>
    <release.sign.skip>false</release.sign.skip>
    <java.version>1.8</java.version>
    <ossrh.url>https://oss.sonatype.org</ossrh.url>
  </properties>

  <build>
    <defaultGoal>install</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.0.0-M7</version>
        <configuration>
	  <scmCommentPrefix>[ci skip]</scmCommentPrefix>
          <tagNameFormat>v@{project.version}</tagNameFormat>
          <autoVersionSubmodules>true</autoVersionSubmodules>
	  <releaseProfiles>releases</releaseProfiles>
        </configuration>
      </plugin>
      <plugin> <!-- pretty up the code using google java standards `mvn fmt:format` -->
        <groupId>com.spotify.fmt</groupId>
        <artifactId>fmt-maven-plugin</artifactId>
        <version>2.19</version>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.10.1</version>
          <configuration>
            <debug>true</debug>
            <source>${java.version}</source>
            <target>${java.version}</target>
          </configuration>
        </plugin>
	<plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>buildnumber-maven-plugin</artifactId>
          <version>3.0.0</version>
          <executions>
            <execution>
              <id>detect-scm-revision</id>
              <phase>validate</phase>
              <goals>
		<goal>create</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
            <shortRevisionLength>8</shortRevisionLength>
            <doCheck>false</doCheck>
            <doUpdate>false</doUpdate>
            <timestampFormat>{0,date,yyyyMMdd}</timestampFormat>
          </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</goal>
              </goals>
            </execution>
          </executions>
	</plugin>
	<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0</version>
	</plugin>
	<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.3.0</version>
          <executions>
            <execution>
              <id>default-jar</id>
              <goals>
		<goal>jar</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <archive>
              <manifestEntries>
		<Built-By />
		<Specification-Title>${project.name}</Specification-Title>
		<Specification-Version>${project.version}</Specification-Version>
		<Specification-Vendor>${project.organization.name}</Specification-Vendor>
		<Implementation-Title>${project.name}</Implementation-Title>
		<Implementation-Version>${project.version}</Implementation-Version>
		<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
		<Implementation-Build>${implementation.build}</Implementation-Build>
              </manifestEntries>
            </archive>
          </configuration>
	</plugin>
      </plugins>
    </pluginManagement>
  </build>
  
  <profiles>
    <profile>
      <id>doclint-java8-disable</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.4.1</version>
            <configuration>
	      <source>8</source>
              <additionalparam>-Xdoclint:none</additionalparam>
	      <detectJavaApiLink>false</detectJavaApiLink>
	    </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>releases</id>
      <build>
        <plugins>
	  <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-javadoc-plugin</artifactId>
	    <version>3.4.1</version>
	    <executions>
              <execution>
		<id>attach-javadocs</id>
		<goals>
		  <goal>jar</goal>
		</goals>
              </execution>
	    </executions>
	  </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.0.1</version>
	    <configuration>
	      <gpgArguments>
		<arg>--pinentry-mode</arg>
		<arg>loopback</arg>
	      </gpgArguments>
	    </configuration>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <skip>${release.sign.skip}</skip>
                </configuration>
              </execution>
            </executions>
	  </plugin>
	  <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <extensions>true</extensions>
            <version>1.6.13</version>
            <executions>
              <execution>
                <id>default-deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
	      <serverId>ossrh</serverId>
	      <nexusUrl>${ossrh.url}/</nexusUrl>
	      <autoReleaseAfterClose>true</autoReleaseAfterClose>
	      <!-- <autoDropAfterRelease>true</autoDropAfterRelease> -->
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
