<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>com.acxiom</groupId>
    <artifactId>metalus</artifactId>
    <version>1.7.2</version>
    <name>${project.artifactId}</name>
    <packaging>pom</packaging>
    <description>Metalus Pipeline Library</description>
    <inceptionYear>2018</inceptionYear>

    <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>

    <url>https://github.com/Acxiom/metalus</url>

    <scm>
        <connection>scm:git@github.com:Acxiom/metalus.git</connection>
        <url>https://github.com/Acxiom/metalus</url>
    </scm>

    <developers>
        <developer>
            <name>David Freels Sr.</name>
            <email>david.freels@acxiom.com</email>
            <organization>Acxiom</organization>
            <organizationUrl>http://acxiom.com</organizationUrl>
        </developer>
        <developer>
            <name>Ed Balogh</name>
            <email>ed.balogh@acxiom.com</email>
            <organization>Acxiom</organization>
            <organizationUrl>http://acxiom.com</organizationUrl>
        </developer>
        <developer>
            <name>David Freels Jr.</name>
            <email>david.a.freels@acxiom.com</email>
            <organization>Acxiom</organization>
            <organizationUrl>http://acxiom.com</organizationUrl>
        </developer>
    </developers>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <encoding>UTF-8</encoding>
        <scala.version>2.11.12</scala.version>
        <scala.compat.version>2.11</scala.compat.version>
        <spark.compat.version>2.3</spark.compat.version>
        <spark.version>2.3.3</spark.version>
        <json4s.version>3.2.11</json4s.version>
        <mongo.version>2.3.2</mongo.version>
        <scala.style.config>${basedir}/scalastyle_config.xml</scala.style.config>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <sonar.core.codeCoveragePlugin>scoverage</sonar.core.codeCoveragePlugin>
        <sonar.scala.coverage.reportPaths>${project.build.directory}/scoverage.xml</sonar.scala.coverage.reportPaths>
        <sonar.scala.scalastyle.reportPaths>${basedir}/target/checkstyle-result.xml</sonar.scala.scalastyle.reportPaths>
        <sonar.exclusions>src/test/scala/**</sonar.exclusions>
        <jackson.core.version>2.9.7</jackson.core.version>
    </properties>

    <modules>
        <module>metalus-application</module>
        <module>metalus-aws</module>
        <module>metalus-core</module>
        <module>metalus-common</module>
        <module>metalus-examples</module>
        <module>metalus-gcp</module>
        <module>metalus-kafka</module>
        <module>metalus-mongo</module>
        <module>metalus-utils</module>
    </modules>

    <dependencies>
        <!-- Scala -->
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <version>${scala.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-reflect</artifactId>
            <version>${scala.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- JSON Library -->
        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-native_${scala.compat.version}</artifactId>
            <version>${json4s.version}</version>
        </dependency>
        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-ext_${scala.compat.version}</artifactId>
            <version>${json4s.version}</version>
        </dependency>
        <!-- Spark Libraries -->
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_${scala.compat.version}</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_${scala.compat.version}</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- SFTP -->
        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.55</version>
        </dependency>
        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scala.compat.version}</artifactId>
            <version>3.0.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.scalamock</groupId>
            <artifactId>scalamock-scalatest-support_${scala.compat.version}</artifactId>
            <version>3.6.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-minicluster</artifactId>
            <version>3.2.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>27.0.1-jre</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>clean scoverage:report install scala:doc scalastyle:check</defaultGoal>
        <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
        <testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <!-- see http://davidb.github.com/scala-maven-plugin -->
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <args>
                                <arg>-dependencyfile</arg>
                                <arg>${project.build.directory}/.scala_dependencies</arg>
                            </args>
                        </configuration>
                    </execution>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>doc-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>1.2.0</version>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                    <highlighting>true</highlighting>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>4.3.0</version>
                <configuration>
                    <repoToken>${repoToken}</repoToken>
                    <coberturaReports>
                        <coberturaReport>metalus-core/target/cobertura.xml</coberturaReport>
                        <coberturaReport>metalus-common/target/cobertura.xml</coberturaReport>
                        <coberturaReport>metalus-kafka/target/cobertura.xml</coberturaReport>
                    </coberturaReports>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                    <junitxml>.</junitxml>
                    <!-- Test output file. The "WDF" statement provides cleaner output -->
                    <filereports>WDF TestOutput.txt</filereports>
                </configuration>
                <executions>
                    <execution>
                        <id>test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.scalastyle</groupId>
                <artifactId>scalastyle-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <verbose>false</verbose>
                    <failOnViolation>true</failOnViolation>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <failOnWarning>false</failOnWarning>
                    <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>
                    <testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory>
                    <configLocation>${scala.style.config}</configLocation>
                    <outputFile>${basedir}/target/checkstyle-result.xml</outputFile>
                    <outputEncoding>UTF-8</outputEncoding>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>1.2.0</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <!-- To release to Maven central -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>spark_2.3</id>
            <properties>
                <spark.compat.version>2.3</spark.compat.version>
                <spark.version>2.3.3</spark.version>
                <json4s.version>3.2.11</json4s.version>
                <mongo.version>2.3.2</mongo.version>
                <kinesis.client.version>1.7.3</kinesis.client.version>
            </properties>
        </profile>
        <profile>
            <id>spark_2.4</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <spark.compat.version>2.4</spark.compat.version>
                <spark.version>2.4.6</spark.version>
                <json4s.version>3.5.3</json4s.version>
                <mongo.version>2.4.1</mongo.version>
                <kinesis.client.version>1.12.0</kinesis.client.version>
            </properties>
        </profile>
        <profile>
            <id>spark_3.0</id>
            <properties>
                <spark.compat.version>3.0</spark.compat.version>
                <spark.version>3.0.0</spark.version>
                <json4s.version>3.6.6</json4s.version>
                <mongo.version>2.4.1</mongo.version>
                <scala.compat.version>2.12</scala.compat.version>
                <scala.version>2.12.11</scala.version>
                <jackson.core.version>2.11.1</jackson.core.version>
                <kinesis.client.version>1.12.0</kinesis.client.version>
            </properties>
        </profile>
        <profile>
            <id>scala_2.12</id>
            <properties>
                <scala.compat.version>2.12</scala.compat.version>
                <scala.version>2.12.11</scala.version>
            </properties>
        </profile>
    </profiles>

    <distributionManagement>
        <site>
            <id>api.wiki</id>
            <url>https://github.com/Acxiom/metalus/wiki</url>
        </site>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
</project>
