<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2014 Groupon.com
  ~
  ~ Licensed 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.arpnetworking.build</groupId>
  <artifactId>arpnetworking-parent-pom</artifactId>
  <packaging>pom</packaging>
  <name>ArpNetworking Parent POM</name>
  <description>A parent pom file used for ArpNetworking builds.</description>
  <url>https://github.com/arpnetworking/arpnetworking-parent-pom</url>
  <version>1.0.2</version>

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

  <developers>
    <developer>
      <id>brandonarp</id>
      <email>brandonarp@gmail.com</email>
      <organization>Arp Networking</organization>
      <organizationUrl>http://www.arpnetworking.com</organizationUrl>
      <roles>
        <role>developer</role>
      </roles>
    </developer>
    <developer>
      <id>vkoskela</id>
      <email>vkoskela@groupon.com</email>
      <organization>Groupon</organization>
      <organizationUrl>http://www.groupon.com</organizationUrl>
      <roles>
        <role>developer</role>
      </roles>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:ArpNetworking/arpnetworking-parent-pom.git</connection>
    <developerConnection>scm:git:git@github.com:ArpNetworking/arpnetworking-parent-pom.git</developerConnection>
    <url>https://github.com/arpnetworking/arpnetworking-parent-pom</url>
    <tag>arpnetworking-parent-pom-1.0.2</tag>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- Compiler Settings -->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <!--Dependency versions-->
    <build-resources.version>1.0.1</build-resources.version>
    <checkstyle.version>6.10.1</checkstyle.version>

    <!--Plugin versions-->
    <maven.buildnumber.plugin.version>1.3</maven.buildnumber.plugin.version>
    <maven.checkstyle.plugin.version>2.16</maven.checkstyle.plugin.version>
    <maven.compiler.plugin.version>3.3</maven.compiler.plugin.version>
    <maven.dependency.plugin.version>2.10</maven.dependency.plugin.version>
    <maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version>
    <maven.failsafe.plugin.version>2.18.1</maven.failsafe.plugin.version>
    <maven.findbugs.plugin.version>3.0.2</maven.findbugs.plugin.version>
    <maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
    <maven.jar.plugin.version>2.6</maven.jar.plugin.version>
    <maven.javadoc.plugin.version>2.10.3</maven.javadoc.plugin.version>
    <maven.project.info.reports.plugin.version>2.8.1</maven.project.info.reports.plugin.version>
    <maven.release.plugin.version>2.5.2</maven.release.plugin.version>
    <maven.resources.plugin.version>2.7</maven.resources.plugin.version>
    <maven.source.plugin.version>2.4</maven.source.plugin.version>
    <maven.surefire.plugin.version>2.18.1</maven.surefire.plugin.version>
    <maven.surefire.report.plugin.version>2.18.1</maven.surefire.report.plugin.version>
    <maven.versions.plugin.version>2.2</maven.versions.plugin.version>

    <!-- Findbugs -->
    <findbugs.exclude />

    <!-- Code Coverage -->
    <jacoco.maven.plugin.version>0.7.5.201505241946</jacoco.maven.plugin.version>
    <jacoco.check.line.coverage>0.0</jacoco.check.line.coverage>
    <jacoco.check.branch.coverage>0.0</jacoco.check.branch.coverage>
  </properties>

  <profiles>
    <profile>
      <id>ci</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <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>
                <configuration>
                  <keyname>arpnet</keyname>
                  <passphraseServerId>arpnet</passphraseServerId>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <pluginManagement>
      <plugins>
        <!-- Other plugins required by the build -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven.compiler.plugin.version}</version>
          <configuration>
            <showDeprecation>true</showDeprecation>
            <showWarnings>true</showWarnings>
            <compilerArgs>
              <arg>-Xlint:all</arg>
              <arg>-Werror</arg>
            </compilerArgs>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven.dependency.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven.jar.plugin.version}</version>
        </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-surefire-plugin</artifactId>
          <version>${maven.surefire.plugin.version}</version>
          <configuration>
            <parallel>methods</parallel>
            <threadCount>4</threadCount>
            <perCoreThreadCount>true</perCoreThreadCount>
            <argLine>${argLine} -Xms512m -Xmx512m -ea -Duser.timezone="UTC"</argLine>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-report-plugin</artifactId>
          <version>${maven.surefire.report.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven.failsafe.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${maven.checkstyle.plugin.version}</version>
          <executions>
            <execution>
              <id>checkstyle-check</id>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
                <goal>checkstyle</goal>
                <goal>checkstyle-aggregate</goal>
              </goals>
              <configuration>
                <consoleOutput>true</consoleOutput>
                <logViolationsToConsole>true</logViolationsToConsole>
                <failOnViolation>true</failOnViolation>
                <maxAllowedViolations>0</maxAllowedViolations>
                <configLocation>checkstyle.xml</configLocation>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
                <propertyExpansion>suppressions.file=${project.build.directory}/checkstyle-suppressions.xml</propertyExpansion>
                <propertyExpansion>samedir=${project.build.directory}</propertyExpansion>
                <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
                <linkXRef>false</linkXRef>
              </configuration>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${checkstyle.version}</version>
            </dependency>
            <dependency>
              <groupId>com.arpnetworking.build</groupId>
              <artifactId>build-resources</artifactId>
              <version>${build-resources.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>${maven.findbugs.plugin.version}</version>
          <executions>
            <execution>
              <id>findbugs-check</id>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <effort>Max</effort>
            <threshold>Low</threshold>
            <failOnError>true</failOnError>
            <includeTests>true</includeTests>
            <xmlOutput>true</xmlOutput>
            <xmlOutputDirectory>${project.build.directory}</xmlOutputDirectory>
            <excludeFilterFile>${findbugs.exclude}</excludeFilterFile>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${jacoco.maven.plugin.version}</version>
          <executions>
            <execution>
              <id>default-prepare-agent</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
            <execution>
              <id>default-report</id>
              <phase>prepare-package</phase>
              <goals>
                <goal>report</goal>
              </goals>
            </execution>
            <execution>
              <id>default-check</id>
              <goals>
                <goal>check</goal>
              </goals>
              <configuration>
                <rules>
                  <rule>
                    <element>BUNDLE</element>
                    <limits>
                      <limit>
                        <counter>COMPLEXITY</counter>
                        <value>COVEREDRATIO</value>
                        <minimum>${jacoco.check.line.coverage}</minimum>
                      </limit>
                      <limit>
                        <counter>BRANCH</counter>
                        <value>COVEREDRATIO</value>
                        <minimum>${jacoco.check.branch.coverage}</minimum>
                      </limit>
                    </limits>
                  </rule>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>${maven.versions.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>buildnumber-maven-plugin</artifactId>
          <version>${maven.buildnumber.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven.release.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${maven.deploy.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>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven.javadoc.plugin.version}</version>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-build-resources</id>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <outputDirectory>${project.build.directory}</outputDirectory>
              <includeArtifactIds>build-resources</includeArtifactIds>
              <includeGroupIds>com.arpnetworking.build</includeGroupIds>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>${maven.project.info.reports.plugin.version}</version>
      </plugin>
    </plugins>
  </reporting>
  <dependencies>
    <dependency>
      <groupId>com.arpnetworking.build</groupId>
      <artifactId>build-resources</artifactId>
      <version>${build-resources.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>
</project>
