<?xml version="1.0" encoding="UTF-8"?>
<!--
~   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>

  <parent>
    <groupId>org.basepom</groupId>
    <artifactId>basepom-standard</artifactId>
    <version>5</version>
    <relativePath>../standard</relativePath>
  </parent>

  <artifactId>basepom-standard-oss</artifactId>
  <packaging>pom</packaging>

<!--
  <name>basepom-standard-oss</name>
  <description>Same as standard base POM, but also includes packaging and deployment for oss.sonatype.org</description>
  <url>https://github.com/basepom/basepom/standard-oss</url>
-->

  <properties>
    <!-- License checker for OSS deployments. -->
    <basepom.check.skip-license>${basepom.check.skip-extended}</basepom.check.skip-license>
    <basepom.check.fail-license>${basepom.check.fail-extended}</basepom.check.fail-license>

    <!-- Some plugins can run early ("validate") or late ("verify") -->
    <basepom.check.phase-license>verify</basepom.check.phase-license>

    <basepom.license.skip-existing>true</basepom.license.skip-existing>

    <!-- Plugin versions -->
    <dep.plugin.license.version>2.6</dep.plugin.license.version>
    <dep.plugin.gpg.version>1.5</dep.plugin.gpg.version>

  </properties>

  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Nexus Release Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <configuration>
            <releaseProfiles>oss-release</releaseProfiles>
          </configuration>
        </plugin>

        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>${dep.plugin.license.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.basepom</groupId>
              <artifactId>basepom-policy</artifactId>
              <version>${dep.basepom-policy.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <skip>${basepom.check.skip-license}</skip>
            <skipExistingHeaders>${basepom.license.skip-existing}</skipExistingHeaders>
            <failIfMissing>${basepom.check.fail-license}</failIfMissing>
            <header>license/basepom-apache-license-header.txt</header>
            <headerDefinitions>
              <headerDefinition>license/xml-prefix.xml</headerDefinition>
            </headerDefinitions>
            <mapping>
              <xml>XML_PREFIX</xml>
              <java>SLASHSTAR_STYLE</java>
            </mapping>
            <strictCheck>true</strictCheck>
            <aggregate>true</aggregate>
            <useDefaultExcludes>true</useDefaultExcludes>
            <encoding>${project.build.sourceEncoding}</encoding>
            <excludes>
              <exclude>.*/**</exclude>
              <exclude>**/*.md</exclude>
              <exclude>**/*.sh</exclude>
              <exclude>**/*.txt</exclude>
              <exclude>**/*.thrift</exclude>
              <exclude>**/*.proto</exclude>
              <exclude>**/*.g</exclude>
              <exclude>**/*.releaseBackup</exclude>
              <exclude>**/*.vm</exclude>
              <exclude>**/*.st</exclude>
              <exclude>**/*.raw</exclude>
              <exclude>**/*.ser</exclude>
              <exclude>**/src/license/**</exclude>
            </excludes>
            <includes>
              <include>src/**</include>
              <include>**/pom.xml</include>
            </includes>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${dep.plugin.gpg.version}</version>
          <configuration>
            <useAgent>true</useAgent>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <!-- Plugins that only execute on JDK 7+ go here. -->
    <profile>
      <id>jdk7</id>
      <activation>
        <jdk>[1.7,]</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>default</id>
                <phase>${basepom.check.phase-license}</phase>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>oss-release</id>
      <properties>
        <!-- tests run in the preparation step of the release -->
        <skipTests>true</skipTests>
      </properties>
      <build>
        <plugins>
          <!-- oss requires a javadoc jar. Build one when releasing. -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Sign artifacts using gpg for oss upload -->
          <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>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
