<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (C) 2015-2016 apifocal LLC - https://www.apifocal.com

    This source code is available under a license agreement available at
    $HOME/LICENSE

    You should have received a copy of the agreement along with this
    program; if not, contact apifocal LLC.

    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>org.apifocal</groupId>
    <artifactId>apifocal-oss</artifactId>
    <version>1</version>
    <packaging>pom</packaging>

    <name>apifocal oss parent</name>
    <description>Maven parent POM for apifocal open source projects.</description>
    <url>https://www.apifocal.org/</url>
    <organization>
        <name>apifocal</name>
        <url>https://www.apifocal.org/</url>
    </organization>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:apifocal/apifocal-oss.git</connection>
        <developerConnection>scm:git:git@github.com:apifocal/apifocal-oss.git</developerConnection>
        <tag>apifocal-oss-1</tag>
        <url>https://github.com/apifocal/apifocal-oss</url>
    </scm>
    <developers>
        <developer>
            <id>hadrian</id>
            <name>Hadrian Zbarcea</name>
            <email>hadrian@apache.org</email>
            <url>https://apifocal.com/blog</url>
            <organization>apifocal</organization>
            <organizationUrl>https://apifocal.com</organizationUrl>
        </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>

    <repositories>
        <repository>
            <id>apifocal-releases</id>
            <name>${apifocal.releases.repo.name}</name>
            <url>${apifocal.releases.repo.url}</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>apifocal-snapshots</id>
            <name>${apifocal.snapshots.repo.name}</name>
            <url>${apifocal.snapshots.repo.url}</url>
            <releases>
                <enabled>false</enabled>
            </releases>
             <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>apifocal-releases</id>
            <name>${apifocal.releases.repo.name}</name>
            <url>${apifocal.releases.repo.url}</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>apifocal-snapshots</id>
            <name>${apifocal.snapshots.repo.name}</name>
            <url>${apifocal.snapshots.repo.url}</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <properties>
        <organization.logo>https://www.apifocal.org/img/logo.png</organization.logo>

        <apifocal.releases.repo.name>apifocal releases</apifocal.releases.repo.name>
        <apifocal.releases.repo.url>https://archiva.apifocal.org/repository/apifocal-releases</apifocal.releases.repo.url>
        <apifocal.snapshots.repo.name>apifocal snapshots</apifocal.snapshots.repo.name>
        <apifocal.snapshots.repo.url>https://archiva.apifocal.org/repository/apifocal-snapshots</apifocal.snapshots.repo.url>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <sourceReleaseAssemblyDescriptor>source-release</sourceReleaseAssemblyDescriptor>
        <gpg.useagent>true</gpg.useagent>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
        <apifocal.compile.show.deprecation>true</apifocal.compile.show.deprecation>
        <apifocal.compile.flags>-Xlint:unchecked,deprecation,fallthrough,finally</apifocal.compile.flags>

        <!-- plugin versions -->
        <bom-maven-plugin.version>0.2.0</bom-maven-plugin.version>
        <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
        <buildnumber-maven-plugin.version>1.4</buildnumber-maven-plugin.version>
        <depends-maven-plugin.version>1.4.0</depends-maven-plugin.version>
        <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
        <git-commit-id-plugin.version>2.2.4</git-commit-id-plugin.version>
        <karaf-maven-plugin.version>4.0.9</karaf-maven-plugin.version>
        <lifecycle-mapping.version>1.0.0</lifecycle-mapping.version>
        <maven-assembly-plugin.version>3.1.0</maven-assembly-plugin.version>
        <maven-bundle-plugin.version>3.4.0</maven-bundle-plugin.version>
        <maven-clean-plugin.version>3.0.0</maven-clean-plugin.version>
        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
        <maven-dependency-plugin.version>3.0.2</maven-dependency-plugin.version>
        <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
        <maven-enforcer-plugin.version>3.0.0-M1</maven-enforcer-plugin.version>
        <maven-failsafe-plugin.version>2.20.1</maven-failsafe-plugin.version>
        <maven-install-plugin.version>2.5.2</maven-install-plugin.version>
        <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
        <maven-plugin-plugin.version>3.5</maven-plugin-plugin.version>
        <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
        <maven-remote-resources-plugin.version>1.5</maven-remote-resources-plugin.version>
        <maven-resource-plugin.version>3.0.2</maven-resource-plugin.version>
        <maven-site-plugin.version>3.6</maven-site-plugin.version>
        <maven-surefire-plugin.version>2.20.1</maven-surefire-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
        <properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <!-- TODO: organize alphabetically -->
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>${maven-bundle-plugin.version}</version>
                    <extensions>true</extensions>
                </plugin>
                <plugin>
                    <groupId>org.apache.karaf.tooling</groupId>
                    <artifactId>karaf-maven-plugin</artifactId>
                    <version>${karaf-maven-plugin.version}</version>
                    <extensions>true</extensions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${maven-assembly-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven-clean-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <compilerArgument>${apifocal.compile.flags}</compilerArgument>
                        <showDeprecation>${apifocal.compile.show.deprecation}</showDeprecation>
                        <showWarnings>true</showWarnings>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${exec-maven-plugin.version}</version>
                    <configuration>
                        <includePluginDependencies>false</includePluginDependencies>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>pl.project13.maven</groupId>
                    <artifactId>git-commit-id-plugin</artifactId>
                    <version>${git-commit-id-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>revision</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <verbose>true</verbose>
                        <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
                        <generateGitPropertiesFile>true</generateGitPropertiesFile>
                        <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven-install-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${maven-plugin-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                    <configuration>
                        <releaseProfiles>apifocal-release</releaseProfiles>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-remote-resources-plugin</artifactId>
                    <version>${maven-remote-resources-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resource-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${maven-site-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.servicemix.tooling</groupId>
                    <artifactId>depends-maven-plugin</artifactId>
                    <version>${depends-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apifocal.maven.plugins</groupId>
                    <artifactId>bom-maven-plugin</artifactId>
                    <version>${bom-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${build-helper-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>buildnumber-maven-plugin</artifactId>
                    <version>${buildnumber-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>properties-maven-plugin</artifactId>
                    <version>${properties-maven-plugin.version}</version>
                </plugin>

            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!--
                     doCheck and doUpdate actually talk to repository if it's true,
                     Check would check that there are no local changes.
                    -->
                    <!-- override this on command line when releasing                -->
                    <!-- -Dmaven.buildNumber.doCheck=true                           -->
                    <doCheck>false</doCheck>

                    <!-- if true update the buildnumber with the latest scm revision -->
                    <!-- override this on command line when releasing                -->
                    <!-- -Dmaven.buildNumber.doUpdate=true                           -->
                    <doUpdate>false</doUpdate>

                    <!-- same scm revision for all modules -->
                    <getRevisionOnlyOnce>true</getRevisionOnlyOnce>

                    <!-- if no scm available use this string - prevents exception -->
                    <revisionOnScmFailure>NOREVISION</revisionOnScmFailure>

                    <timestampFormat>{0,date,yyyy-MM-dd hh:mm:ss}</timestampFormat>
                </configuration>
            </plugin>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifestEntries>
                            <Implementation-Version>${project.version} Build: ${revision} Timestamp: ${maven.build.timestamp}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.3.9</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>1.8</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${nexus-staging-maven-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>apifocal-release</id>
            <build>
                <!-- TBD -->
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>disable-javadoc-doclint</id>
            <!-- see http://stackoverflow.com/questions/34354385/mvn-releaseperform-fails-in-java-8-added-javadoc-plugin -->
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <properties>
                <additionalparam>-Xdoclint:none</additionalparam>
            </properties>
        </profile>
    </profiles>

</project>
