<!--
Copyright 2016 Google Inc. All Rights Reserved.

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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.google.cloud.samples</groupId>
  <artifactId>shared-configuration</artifactId>
  <version>1.0.5</version>
  <packaging>pom</packaging>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>A shared configuration for Google Cloud samples. This defines
    common plugins and their configurations for testing, maintenance, and style
    checks.</description>
  <url>https://github.com/GoogleCloudPlatform/java-repo-tools</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>Les Vogel</name>
      <email>lesv@google.com</email>
      <organization>Google Inc.</organization>
      <organizationUrl>https://cloud.google.com</organizationUrl>
    </developer>
    <developer>
      <name>Tim Swast</name>
      <email>swast@google.com</email>
      <organization>Google Inc.</organization>
      <organizationUrl>https://cloud.google.com</organizationUrl>
    </developer>
    <developer>
      <name>Jisha Abubaker</name>
      <email>jishaa@google.com</email>
      <organization>Google Inc.</organization>
      <organizationUrl>https://cloud.google.com</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:GoogleCloudPlatform/java-repo-tools.git</connection>
    <developerConnection>scm:git:git@github.com:GoogleCloudPlatform/java-repo-tools.git</developerConnection>
    <url>git@github.com:GoogleCloudPlatform/java-repo-tools.git</url>
    <tag>v1.0.5</tag>
  </scm>

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

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

    <jacoco-maven-plugin>0.7.9</jacoco-maven-plugin>
    <plexus-compiler-javac-errorprone>2.8.2</plexus-compiler-javac-errorprone>
    <error_prone_core>2.0.21</error_prone_core>

    <maven-failsafe-plugin>2.20</maven-failsafe-plugin>
    <maven-surefire-plugin>2.20</maven-surefire-plugin>
    <maven-checkstyle-plugin>2.17</maven-checkstyle-plugin>
    <maven-clean-plugin>3.0.0</maven-clean-plugin>
    <maven-deploy-plugin>2.8.2</maven-deploy-plugin>
    <maven-install-plugin>2.5.2</maven-install-plugin>
    <maven-site-plugin>3.6</maven-site-plugin>
    <maven-compiler-plugin>3.6.1</maven-compiler-plugin>
    <maven-resources-plugin>3.0.2</maven-resources-plugin>
    <maven-war-plugin>3.0.0</maven-war-plugin>
    <maven-assembly-plugin>3.0.0</maven-assembly-plugin>
    <maven-jar-plugin>3.0.2</maven-jar-plugin>
    <maven-source-plugin>3.0.1</maven-source-plugin>
    <maven-archetype-plugin>3.0.1</maven-archetype-plugin>

    <maven-release-plugin>2.5.3</maven-release-plugin>
    <nexus-staging-maven-plugin>1.6.8</nexus-staging-maven-plugin>
    <versions-maven-plugin>2.4</versions-maven-plugin>
    <maven-gpg-plugin>1.6</maven-gpg-plugin>
  </properties>

  <profiles>
    <!-- Code signing for release: http://stackoverflow.com/a/14869692/101923 -->
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven-source-plugin}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-archetype-plugin</artifactId>
            <version>${maven-archetype-plugin}</version>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <keyname>${gpg.keyname}</keyname>
                  <passphraseServerId>${gpg.keyname}</passphraseServerId>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <plugins>
      <!-- Compiler -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin}</version>
        <configuration>
          <compilerId>javac-with-errorprone</compilerId>
          <forceJavacCompilerUse>true</forceJavacCompilerUse>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-compiler-javac-errorprone</artifactId>
            <version>${plexus-compiler-javac-errorprone}</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>${error_prone_core}</version>
          </dependency>
        </dependencies>
      </plugin>

     <!-- Unit tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin}</version>
        <configuration>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
      </plugin>
      <plugin>
        <!-- Integration / system tests -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven-failsafe-plugin}</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin}</version>
        <configuration>
          <configLocation>google-checks.xml</configLocation>
          <consoleOutput>true</consoleOutput>
          <failOnViolation>true</failOnViolation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <suppressionsLocation>suppressions.xml</suppressionsLocation>
        </configuration>
        <dependencies>
          <!-- Add a dependency to use bundled resources.
               See: http://stackoverflow.com/a/19690484/101923 -->

          <dependency>
            <groupId>com.google.cloud.samples</groupId>
            <artifactId>checkstyle-configuration</artifactId>
            <version>1.0.1</version>
          </dependency>

          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>8.1</version>
          </dependency>

        </dependencies>
        <executions>
          <execution><goals><goal>check</goal></goals></execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>${versions-maven-plugin}</version>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
