<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2017 Barclays Africa Group Limited
  ~
  ~ 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>
    <artifactId>spline-sample</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>za.co.absa.spline</groupId>
        <artifactId>spline-parent</artifactId>
        <relativePath>../parent/pom.xml</relativePath>
        <version>0.2.2</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_${scala.compat.version}</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_${scala.compat.version}</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>za.co.absa.spline</groupId>
            <artifactId>spline-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>za.co.absa.spline</groupId>
            <artifactId>spline-persistence-mongo</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>za.co.absa.spline</groupId>
            <artifactId>spline-persistence-atlas</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>za.co.absa.spline</groupId>
            <artifactId>spline-persistence-hdfs</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.databricks</groupId>
            <artifactId>spark-xml_${scala.compat.version}</artifactId>
            <version>0.4.1</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>shade</id>
            <dependencies>
                <dependency>
                    <groupId>org.apache.spark</groupId>
                    <artifactId>spark-core_${scala.compat.version}</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.spark</groupId>
                    <artifactId>spark-sql_${scala.compat.version}</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.scala-lang</groupId>
                    <artifactId>scala-library</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.scala-lang</groupId>
                    <artifactId>scala-reflect</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>scalap</artifactId>
                    <version>${scala.version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <shadedClassifierName>shaded</shadedClassifierName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>license-check</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.rat</groupId>
                        <artifactId>apache-rat-plugin</artifactId>
                        <configuration>
                            <excludes combine.children="append">
                                <exclude>data/**</exclude>
                                <exclude>**/atlas-application.properties</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>samples</id>
            <properties>
                <spline.mongodb.url><!-- passed from mvn command line --></spline.mongodb.url>
                <spline.mongodb.name><!-- passed from mvn command line --></spline.mongodb.name>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.scalatest</groupId>
                        <artifactId>scalatest-maven-plugin</artifactId>
                        <configuration>
                            <skipTests>false</skipTests>
                            <systemProperties>
                                <spline.mongodb.url>${spline.mongodb.url}</spline.mongodb.url>
                                <spline.mongodb.name>${spline.mongodb.name}</spline.mongodb.name>
                            </systemProperties>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>