<?xml version="1.0" encoding="UTF-8"?>
<!--
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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>

    <groupId>org.apache.kudu</groupId>
    <artifactId>kudu-parent</artifactId>
    <version>1.7.1</version>
    <packaging>pom</packaging>

    <!-- inherit from the ASF POM for distribution management -->
    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>18</version>
        <relativePath/>
    </parent>

    <name>Kudu</name>

    <description>
        Kudu.
    </description>

    <!-- Properties Management -->
    <properties>
        <!-- Platform encoding override -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Maven plugins -->
        <clojure-maven-plugin.version>1.7.1</clojure-maven-plugin.version>
        <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
        <maven-assembly-plugin.version>3.0.0</maven-assembly-plugin.version>
        <maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version>
        <maven-compiler-plugin.version>3.6.2</maven-compiler-plugin.version>
        <maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
        <!-- Note: Bumping maven-failsafe-plugin to 2.19+ breaks the integration tests due to shading issues -->
        <maven-failsafe-plugin.version>2.18</maven-failsafe-plugin.version>
        <maven-os-plugin.version>1.5.0.Final</maven-os-plugin.version>
        <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
        <maven-protoc-plugin.version>0.5.0</maven-protoc-plugin.version>
        <maven-shade-plugin.version>3.0.0</maven-shade-plugin.version>
        <maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
        <scala-maven-plugin.version>3.2.2</scala-maven-plugin.version>

        <!-- Library dependencies -->
        <async.version>1.4.1</async.version>
        <avro.version>1.8.2</avro.version>
        <clojure.tools.version>0.3.5</clojure.tools.version>
        <clojure.version>1.8.0</clojure.version>
        <commons-io.version>2.6</commons-io.version>
        <flume.version>1.7.0</flume.version>
        <guava.version>20.0</guava.version>
        <hadoop.version>2.9.0</hadoop.version>
        <hamcrest-core.version>1.3</hamcrest-core.version>
        <hive.version>2.3.2</hive.version>
        <jepsen.version>0.1.5</jepsen.version>
        <jsr305.version>3.0.2</jsr305.version>
        <junit.version>4.12</junit.version>
        <log4j.version>1.2.17</log4j.version>
        <mockito-core.version>2.15.0</mockito-core.version>
        <murmur.version>1.0.0</murmur.version>
        <netty.version>3.10.6.Final</netty.version>
        <parquet.version>1.9.0</parquet.version>
        <!-- Upgrading protobuf breaks el6 compatibility
             https://github.com/google/protobuf/issues/4109 -->
        <protobuf.version>3.4.0</protobuf.version>
        <slf4j.version>1.7.25</slf4j.version>
        <sparkavro.version>3.2.0</sparkavro.version>
        <yetus.version>0.7.0</yetus.version>

        <!-- Scala Library dependencies -->
        <scala.binary.version>2.11</scala.binary.version>
        <scala.version>2.11.12</scala.version>
        <scalatest.version>3.0.5</scalatest.version>
        <spark.version>2.2.1</spark.version>
        <spark.version.label>spark2</spark.version.label>

        <!-- Misc variables -->
        <testdata.dir>${project.build.directory}/testdata</testdata.dir>
        <testArgLine>-enableassertions -Xmx1900m
            -Djava.security.egd=file:/dev/urandom -Djava.net.preferIPv4Stack=true
            -Djava.awt.headless=true
        </testArgLine>
    </properties>

    <modules>
        <module>kudu-client-tools</module>
        <module>kudu-client</module>
        <module>kudu-flume-sink</module>
        <module>kudu-hive</module>
        <module>kudu-mapreduce</module>
        <module>kudu-spark-tools</module>
        <module>kudu-spark</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer-plugin.version}</version>
                    <configuration>
                        <rules>
                            <requireMavenVersion>
                                <version>[3.0.2,)</version>
                            </requireMavenVersion>
                            <requireJavaVersion>
                                <version>[1.7,)</version>
                            </requireJavaVersion>
                        </rules>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <failIfNoTests>false</failIfNoTests>
                        <reuseForks>false</reuseForks>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        <argLine>${testArgLine}</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <failIfNoTests>false</failIfNoTests>
                        <reuseForks>false</reuseForks>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        <argLine>${testArgLine}</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${maven-shade-plugin.version}</version>
                    <configuration>
                        <shadeTestJar>true</shadeTestJar>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>clean</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>pre-clean</phase>
                    </execution>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                    <execution>
                        <id>site</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>pre-site</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>${maven-antrun-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <configuration>
                            <target>
                                <delete dir="${testdata.dir}"/>
                                <mkdir dir="${testdata.dir}"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <maxmemory>2048m</maxmemory>
                    <notimestamp>true</notimestamp>
                    <doclet>
                        org.apache.yetus.audience.tools.IncludePublicAnnotationsStandardDoclet
                    </doclet>
                    <docletArtifact>
                        <groupId>org.apache.yetus</groupId>
                        <artifactId>audience-annotations-jdiff</artifactId>
                        <version>${yetus.version}</version>
                    </docletArtifact>
                    <name>User API</name>
                    <description>The Kudu Application Programmer's API</description>
                    <excludePackageNames>
                      com.google:org.apache.kudu.cfile:org.apache.kudu.consensus:org.apache.kudu.log:org.apache.kudu.master:org.apache.kudu.rpc:org.apache.kudu.server:org.apache.kudu.tablet:org.apache.kudu.tserver:org.apache.kudu.hive
                    </excludePackageNames>
                    <includeDependencySources>false</includeDependencySources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>6.19</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <configuration>
                            <configLocation>kudu_style.xml</configLocation>
                            <suppressionsLocation>checkstyle_suppressions.xml</suppressionsLocation>
                            <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
                            <encoding>UTF-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>false</failsOnError>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- Enforce that all of our code uses Java 7 and not Java 8 APIs. -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>animal-sniffer-maven-plugin</artifactId>
                <version>1.16</version>
                <configuration>
                    <signature>
                        <groupId>org.codehaus.mojo.signature</groupId>
                        <artifactId>java17</artifactId>
                        <version>1.0</version>
                    </signature>
                </configuration>
                <executions>
                    <execution>
                        <id>check-java7-apis</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Build the jepsen test for Kudu.

             Disabled by default since Java 8 and maven >= 3.3.6 is required to
             build the kudu-jepsen artifact.  To enable, add '-Pjepsen'
             to the maven command line. -->
        <profile>
            <id>jepsen</id>
            <modules>
                <module>kudu-jepsen</module>
            </modules>
        </profile>
    </profiles>
</project>
