<?xml version="1.0" encoding="UTF-8"?>

<!--
   /*
    *
    *  Copyright 2017 Expedia, 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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>com.expedia.www</groupId>
    <artifactId>haystack-commons-parent</artifactId>
    <version>1.0.64</version>
    <packaging>pom</packaging>

    <scm>
        <connection>scm:git:git://github.com/ExpediaDotCom/haystack-commons.git</connection>
        <developerConnection>scm:git:ssh://github.com/ExpediaDotCom/haystack-commons.git</developerConnection>
        <url>http://github.com/ExpediaDotCom/haystack-commons</url>
    </scm>

    <name>haystack-commons</name>
    <description>This module contains some of the common code for haystack modules</description>
    <url>https://github.com/ExpediaDotCom/haystack-commons/tree/master</url>

    <licenses>
        <!--
           /*
            *
            *  Copyright 2017 Expedia, 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.
            *
            */
          -->
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>haystack</id>
            <name>Haystack Team</name>
            <email>haystack@expedia.com</email>
            <url>https://github.com/ExpediaDotCom/haystack</url>
        </developer>
    </developers>

    <modules>
        <module>idl</module>
        <module>commons</module>
    </modules>

    <properties>
        <!-- dependency properties -->
        <typesafe-config.version>1.3.1</typesafe-config.version>
        <metrics-core.version>3.0.2</metrics-core.version>
        <protobuf.version>3.3.1</protobuf.version>
        <slf4j.version>1.7.25</slf4j.version>
        <commons-codec.version>1.4</commons-codec.version>
        <guava.version>19.0</guava.version>

        <msgpack.version>0.8.13</msgpack.version>
        <kafka.version>1.1.1</kafka.version>
        <grpc.version>1.7.0</grpc.version>

        <json4s.version>3.6.0</json4s.version>
        <metrics-java.version>0.4.0</metrics-java.version>

        <!-- compiler properties -->
        <project.jdk.version>1.8</project.jdk.version>
        <scala.major.version>2</scala.major.version>
        <scala.minor.version>12</scala.minor.version>
        <!-- At least 2.12.4 is needed for compiling with JDK 9+ (and Kafka 1.1.1)
             https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html -->
        <scala.maintenance.version>7</scala.maintenance.version>
        <scala.major.minor.version>${scala.major.version}.${scala.minor.version}</scala.major.minor.version>
        <scala-library.version>${scala.major.minor.version}.${scala.maintenance.version}</scala-library.version>

        <!--test dependencies -->
        <pegdown.version>1.6.0</pegdown.version>
        <scalatest.version>3.0.3</scalatest.version>
        <easymock.version>3.4</easymock.version>

        <!-- plugin properties -->
        <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
        <maven-protobuf-plugin.version>3.3.0.1</maven-protobuf-plugin.version>
        <scala-maven-plugin.version>3.4.2</scala-maven-plugin.version>
        <maven-scalatest-plugin.version>1.0</maven-scalatest-plugin.version>
        <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
        <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
        <scalastyle.config.location>${project.basedir}/../scalastyle/scalastyle_config.xml</scalastyle.config.location>
        <maven-scalastyle-plugin.version>0.9.0</maven-scalastyle-plugin.version>
        <scoverage.plugin.version>1.3.0</scoverage.plugin.version>

        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
        <maven-jar-plugin-version>3.1.0</maven-jar-plugin-version>
        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
    </properties>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- Adds this explicitly until gRPC is updated to at least v1.12, for @Generated -->
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>1.3.2</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>com.typesafe</groupId>
                <artifactId>config</artifactId>
                <version>${typesafe-config.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.json4s/json4s-jackson -->
            <dependency>
                <groupId>org.json4s</groupId>
                <artifactId>json4s-jackson_${scala.major.minor.version}</artifactId>
                <version>${json4s.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <scope>provided</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-nop</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-jdk14</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>jcl-over-slf4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-library</artifactId>
                <version>${scala-library.version}</version>
            </dependency>

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>

            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java</artifactId>
                <version>${protobuf.version}</version>
            </dependency>

            <dependency>
                <groupId>com.expedia</groupId>
                <artifactId>metrics-java</artifactId>
                <version>${metrics-java.version}</version>
            </dependency>

            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-protobuf</artifactId>
                <version>${grpc.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-stub</artifactId>
                <version>${grpc.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>com.codahale.metrics</groupId>
                <artifactId>metrics-core</artifactId>
                <version>${metrics-core.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${commons-codec.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka -->
            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka_${scala.major.minor.version}</artifactId>
                <version>${kafka.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-streams</artifactId>
                <version>${kafka.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.msgpack</groupId>
                <artifactId>msgpack-core</artifactId>
                <version>${msgpack.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- test dependencies -->

            <dependency>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest_${scala.major.minor.version}</artifactId>
                <version>${scalatest.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.easymock</groupId>
                <artifactId>easymock</artifactId>
                <version>${easymock.version}</version>
                <scope>test</scope>
            </dependency>

            <!-- required by scalatest-maven-plugin to generate HTML report -->

            <dependency>
                <groupId>org.pegdown</groupId>
                <artifactId>pegdown</artifactId>
                <version>${pegdown.version}</version>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>
        <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>

        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>


        <pluginManagement>
            <plugins>
                <!-- mvn -N io.takari:maven:wrapper -Dmaven=3.5.4 -->
            <plugin>
                <groupId>io.takari</groupId>
                <artifactId>maven</artifactId>
                <version>0.6.1</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${basedir}/src/main/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${project.jdk.version}</source>
                    <target>${project.jdk.version}</target>
                    <encoding>UTF-8</encoding>
                </configuration>
                <version>${maven-compiler-plugin.version}</version>
            </plugin>

            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>${scala-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>scala-compile-first</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>scala-test-compile</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>doc-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.github.os72</groupId>
                <artifactId>protoc-jar-maven-plugin</artifactId>
                <version>${maven-protobuf-plugin.version}</version>
            </plugin>

            <plugin>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
                <version>${maven-scalatest-plugin.version}</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.scalastyle</groupId>
                <artifactId>scalastyle-maven-plugin</artifactId>
                <version>${maven-scalastyle-plugin.version}</version>
                <configuration>
                    <verbose>false</verbose>
                    <failOnViolation>true</failOnViolation>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <failOnWarning>false</failOnWarning>
                    <sourceDirectory>${project.basedir}/src/main/scala</sourceDirectory>
                    <testSourceDirectory>${project.basedir}/src/test/scala</testSourceDirectory>
                    <configLocation>${scalastyle.config.location}</configLocation>
                    <outputFile>${project.build.directory}/scalastyle-output.xml</outputFile>
                    <outputEncoding>UTF-8</outputEncoding>
                </configuration>
                <executions>
                    <execution>
                        <id>compile-scalastyle</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>${scoverage.plugin.version}</version>
                <configuration>
                    <!-- need to update this as improve the coverage -->
                    <minimumCoverage>80</minimumCoverage>
                    <failOnMinimumCoverage>true</failOnMinimumCoverage>
                    <highlighting>true</highlighting>
                    <scalaVersion>${scala-library.version}</scalaVersion>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </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-gpg-plugin</artifactId>
                <version>${maven-gpg-plugin.version}</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </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>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </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-gpg-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>http://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

</project>
