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

  <name>Spotify Root</name>
  <url>https://github.com/spotify/foss-root</url>
  <description>
    The Spotify Root project helps establish consistent Maven conventions by being the parent POM
    for other participating projects.
  </description>

  <groupId>com.spotify</groupId>
  <artifactId>foss-root</artifactId>
  <version>5</version>
  <packaging>pom</packaging>

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

  <scm>
    <url>https://github.com/spotify/foss-root</url>
    <connection>scm:git:git@github.com:spotify/foss-root.git</connection>
    <developerConnection>scm:git:git@github.com:spotify/foss-root.git</developerConnection>
    <tag>v5</tag>
  </scm>

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

  <developers>
    <developer>
      <id>rouzwawi</id>
      <email>rouz@spotify.com</email>
      <name>Rouzbeh Delavari</name>
    </developer>
  </developers>

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

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

    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.5.1</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <compilerArgs>
              <compilerArg>-Xlint:all</compilerArg>
            </compilerArgs>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.0.2</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.4.1</version>
          <executions>
            <execution>
              <id>enforce</id>
              <configuration>
                <rules>
                  <requireUpperBoundDeps />
                </rules>
              </configuration>
              <goals>
                <goal>enforce</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.19.1</version>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <includes>
              <include>**/*IT.java</include>
            </includes>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.17</version>
          <dependencies>
            <dependency>
              <groupId>com.spotify.checkstyle</groupId>
              <artifactId>spotify-checkstyle-config</artifactId>
              <version>1.0.2</version>
            </dependency>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>6.19</version>
            </dependency>
          </dependencies>
          <configuration>
            <configLocation>spotify_checks.xml</configLocation>
            <consoleOutput>true</consoleOutput>
            <!-- Remove or switch to false to keep building even with checkstyle errors -->
            <failOnViolation>true</failOnViolation>
            <logViolationsToConsole>true</logViolationsToConsole>
            <!-- change to 'warning' to be more strict about following checkstyle conventions -->
            <violationSeverity>error</violationSeverity>
          </configuration>
          <executions>
            <execution>
              <id>validate</id>
              <phase>validate</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>1.9</version>
          <configuration>
            <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
            <licenseName>apache_v2</licenseName>
            <organizationName>Spotify AB</organizationName>
            <inceptionYear>2016</inceptionYear>
            <encoding>UTF-8</encoding>
            <failOnMissingHeader>true</failOnMissingHeader>
            <failOnNotUptodateHeader>true</failOnNotUptodateHeader>
            <processStartTag>-\-\-</processStartTag>
            <processEndTag>-/-/-</processEndTag>
            <emptyLineAfterHeader>true</emptyLineAfterHeader>
            <roots>
              <root>src/main/java</root>
              <root>src/test/java</root>
            </roots>
            <sectionDelimiter>--</sectionDelimiter>
          </configuration>
          <executions>
            <execution>
              <id>check-file-header</id>
              <goals>
                <goal>check-file-header</goal>
              </goals>
              <phase>process-sources</phase>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <tagNameFormat>v@{project.version}</tagNameFormat>
            <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
            <releaseProfiles>release</releaseProfiles>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.scm</groupId>
              <artifactId>maven-scm-provider-gitexe</artifactId>
              <version>1.9.4</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.4</version>
            <configuration>
              <failOnError>false</failOnError>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.3</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>

          <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>
  </profiles>
</project>
