<?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-minimal</artifactId>
        <version>36</version>
        <relativePath>../minimal</relativePath>
    </parent>

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

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

        <!-- release profiles -->
        <basepom.release.profiles>basepom.oss-release</basepom.release.profiles>

        <!-- Plugin versions, ordered like http://maven.apache.org/plugins/ -->

        <!-- tools -->
        <dep.plugin.gpg.version>1.6</dep.plugin.gpg.version>

        <!-- https://github.com/mycila/license-maven-plugin/releases -->
        <dep.plugin.license.version>4.0.rc2</dep.plugin.license.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>${basepom.release.profiles}</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>
                            <groovy>SLASHSTAR_STYLE</groovy>
                            <xml>XML_PREFIX</xml>
                            <java>SLASHSTAR_STYLE</java>
                            <yaml>SCRIPT_STYLE</yaml>
                        </mapping>
                        <strictCheck>true</strictCheck>
                        <aggregate>true</aggregate>
                        <useDefaultExcludes>true</useDefaultExcludes>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <excludes>
                            <exclude>.*/**</exclude>
                            <exclude>**/*.md</exclude>
                            <exclude>**/*.rst</exclude>
                            <exclude>**/*.adoc</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>

        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>basepom.default</id>
                        <phase>${basepom.check.phase-license}</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>basepom.oss-release</id>
            <properties>
                <!-- tests run in the preparation step of the release -->
                <skipTests>true</skipTests>
                    <!-- oss requires a javadoc jar. Build one when releasing. -->
                <basepom.check.skip-javadoc>false</basepom.check.skip-javadoc>
            </properties>
            <build>
                <plugins>
                    <!-- Sign artifacts using gpg for oss upload -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>basepom.release.default</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
