<?xml version="1.0"?>
<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>nz.net.osnz.parent</groupId>
  <artifactId>central-parent</artifactId>
  <version>6.2</version>
  <packaging>pom</packaging>

  <name>central-parent</name>
  <description>
		Packaging parent for OSNZ.NET Maven projects.
		Defines rules for all projects packaging in this github fork.
		The release plugin will need to be overridden for each project so it maintains the correct structure for Github.
  </description>
  <url>https://github.com/OpenSourceNZ/central-parent</url>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Kefeng Deng</name>
      <email>deng@51any.com</email>
    </developer>
  </developers>

  <scm>
    <!-- This setting will be replaced by the maven-release-plugin -->
    <url>https://github.com/OpenSourceNZ/central-parent</url>
    <connection>scm:git:git@github.com/OpenSourceNZ/central-parent.git</connection>
    <developerConnection>scm:git:git@github.com:OpenSourceNZ/central-parent.git</developerConnection>
    <tag>central-parent-6.2</tag>
  </scm>

  <properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <repository.release.id>oss-release</repository.release.id>
    <repository.release.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</repository.release.url>
    <repository.snapshot.id>oss-snapshot</repository.snapshot.id>
    <repository.snapshot.url>https://oss.sonatype.org/content/repositories/snapshots/</repository.snapshot.url>
  </properties>

  <distributionManagement>
    <repository>
      <id>${repository.release.id}</id>
      <name>Release (Staging) Repository</name>
      <url>${repository.release.url}</url>
    </repository>
    <snapshotRepository>
      <id>${repository.snapshot.id}</id>
      <name>Snapshot Repository</name>
      <url>${repository.snapshot.url}</url>
    </snapshotRepository>
  </distributionManagement>

  <profiles>
    <profile>
      <id>sonaytpe</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>sonatype-oss-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <version>1.11.2</version>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>3.0.0-M1</version>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <!-- make sure source and javadocs are included in artifacts on release -->
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <preparationGoals>clean validate enforcer:enforce verify</preparationGoals>
            <goals>enforcer:enforce deploy</goals>
            <tagBase>release/${project.groupId}/</tagBase>
            <pushChanges>false</pushChanges>
            <localCheckout>true</localCheckout>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0-M2</version>
          <configuration>
            <rules>
              <requireReleaseDeps>
                <!--  Don't allow releases with SNAPSHOT deps or parents -->
                <message>No SNAPSHOTs allowed in depedency tree or parents allowed when releasing!</message>
                <failWhenParentIsSnapshot>true</failWhenParentIsSnapshot>
                <searchTransitive>true</searchTransitive>
              </requireReleaseDeps>
              <bannedDependencies>
                <message>Please ensure you exclude all dependencies on logging implementations</message>
                <excludes>
                  <exclude>commons-logging</exclude>
                  <exclude>commons-logging-api</exclude>
                  <exclude>log4j:log4j</exclude>
                </excludes>
              </bannedDependencies>
            </rules>
            <fail>true</fail>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.1.1</version>
          <executions>
            <execution>
              <id>generate-dep-list</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>list</goal>
              </goals>
              <configuration>
                <outputFile>${project.build.outputDirectory}/META-INF/maven/${project.groupId}/${project.artifactId}/dependency.list</outputFile>
              </configuration>
            </execution>
            <execution>
              <id>generate-dep-tree</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>tree</goal>
              </goals>
              <configuration>
                <outputFile>${project.build.outputDirectory}/META-INF/maven/${project.groupId}/${project.artifactId}/dependency.tree</outputFile>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.0.0</version>
          <executions>
            <execution>
              <id>attach-artifacts</id>
              <phase>package</phase>
              <goals>
                <goal>attach-artifact</goal>
              </goals>
              <configuration>
                <artifacts>
                  <artifact>
                    <file>${project.build.outputDirectory}/META-INF/maven/${project.groupId}/${project.artifactId}/dependency.tree</file>
                    <type>tree</type>
                    <classifier>dependency</classifier>
                  </artifact>
                  <artifact>
                    <file>${project.build.outputDirectory}/META-INF/maven/${project.groupId}/${project.artifactId}/dependency.list</file>
                    <type>list</type>
                    <classifier>dependency</classifier>
                  </artifact>
                </artifacts>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

</project>
