<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2011, CloudBees Inc.
  ~
  ~ 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.cloudbees</groupId>
  <artifactId>cloudbees-oss-parent</artifactId>
  <version>8</version>
  <packaging>pom</packaging>

  <name>cloudbees-oss-parent</name>
  <description>The CloudBees OSS Parent Project</description>
  <url>https://github.com/cloudbees/cloudbees-oss-parent</url>
  <inceptionYear>2011</inceptionYear>
  <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>stephenc</id>
      <name>Stephen Connolly</name>
    </developer>
  </developers>
  <contributors />

  <mailingLists />

  <scm>
    <connection>scm:git:git://github.com/cloudbees/cloudbees-oss-parent.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/cloudbees/cloudbees-oss-parent.git</developerConnection>
    <url>http://github.com/cloudbees/cloudbees-oss-parent/tree/master/</url>
    <tag>cloudbees-oss-parent-8</tag>
  </scm>
  <issueManagement />
  <ciManagement />
  <distributionManagement>
    <snapshotRepository>
      <id>cloudbees-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>${sonatypeOssDistMgmtSnapshotsUrl}</url>
    </snapshotRepository>
    <repository>
      <id>cloudbees-nexus-staging</id>
      <name>Nexus Release Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <properties>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/
    </sonatypeOssDistMgmtSnapshotsUrl>
    <git.provider>git</git.provider>
    <maven-scm.version>1.9.4</maven-scm.version>
    <arguments> </arguments>
  </properties>

  <repositories>
    <repository>
      <id>cloudbees-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>${sonatypeOssDistMgmtSnapshotsUrl}</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <dependencyManagement>
    <dependencies>
      <!--  as we are pushing findbugs it makes sense that we define the findbugs annotations here -->
      <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>annotations</artifactId>
        <version>3.0.0</version>
        <scope>provided</scope>
        <optional>true</optional>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.5.5</version>
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.6.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.10</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.18.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.6</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
           <version>2.7</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.2</version>
          <configuration>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <useReleaseProfile>false</useReleaseProfile>
            <arguments>-P+cloudbees-oss-release ${arguments}</arguments>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.18.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.6</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>3.0.1</version>
          <executions>
            <execution>
              <id>findbugs</id>
              <goals>
                <goal>check</goal>
              </goals>
              <phase>verify</phase>
              <configuration>
                <!--  Do not define excludeFilterFile here as it will force a plugin to provide a file -->
                <!--  Instead we configure this in a profile -->
                <xmlOutput>true</xmlOutput>
                <findbugsXmlOutput>false</findbugsXmlOutput>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>[3.0,)</version>
                  <message>Maven 2.x is end of life</message>
                </requireMavenVersion>
                <requireMavenVersion>
                  <version>(,3.0),[3.0.4,)</version>
                  <message>Maven 3.0 through 3.0.3 inclusive do not pass correct settings.xml to Maven Release Plugin.
                  </message>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.5</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>cloudbees-nexus-snapshots</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
          <!--stagingProfileId>2ba52c484c574d</stagingProfileId--><!-- if groupId starts with com.cloudbees-->
          <!--stagingProfileId>2acf39d998ccd7</stagingProfileId--><!-- if groupId starts with org.cloudbees-->
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>cloudbees-oss-release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jgit-scm-provider</id>
      <activation>
        <property>
          <name>git.provider</name>
          <value>jgit</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
              <providerImplementations>
                <git>${git.provider}</git>
              </providerImplementations>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.apache.maven.scm</groupId>
                <artifactId>maven-scm-provider-jgit</artifactId>
                <version>${maven-scm.version}</version>
              </dependency>
            </dependencies>
          </plugin>
          <plugin>
            <artifactId>maven-scm-plugin</artifactId>
            <version>${maven-scm.version}</version>
            <configuration>
              <providerImplementations>
                <git>${git.provider}</git>
              </providerImplementations>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.apache.maven.scm</groupId>
                <artifactId>maven-scm-provider-jgit</artifactId>
                <version>${maven-scm.version}</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>findbugs-exclusion-file</id>
      <activation>
        <file>
          <exists>${basedir}/src/findbugs/excludesFilter.xml</exists>
        </file>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>findbugs-maven-plugin</artifactId>
              <executions>
                <execution>
                  <id>findbugs</id>
                  <configuration>
                    <excludeFilterFile>${project.basedir}/src/findbugs/excludesFilter.xml</excludeFilterFile>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>
</project>
