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

  <parent>
    <groupId>org.apache.carbondata</groupId>
    <artifactId>carbondata-parent</artifactId>
    <version>1.5.1-mrs-2.0</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <artifactId>carbondata-spark2</artifactId>
  <name>Apache CarbonData :: Spark2</name>

  <properties>
    <dev.path>${basedir}/../../dev</dev.path>
    <jacoco.append>true</jacoco.append>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.carbondata</groupId>
      <artifactId>carbondata-spark-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.carbondata</groupId>
      <artifactId>carbondata-cli</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.carbondata</groupId>
      <artifactId>carbondata-store-sdk</artifactId>
      <version>${project.version}</version>
    </dependency>
    <!--<dependency>
      <groupId>org.apache.carbondata</groupId>
      <artifactId>carbondata-lucene</artifactId>
      <version>${project.version}</version>
      <exclusions>-->
        <!-- need to Exclude net.jpountz jar from this project.
         Spark has changed this jar to org.lz4:lz4-java
         net.jpountz and org.lz4 has same class Name -->
        <!--<exclusion>
          <groupId>net.jpountz.lz4</groupId>
          <artifactId>lz4</artifactId>
        </exclusion>
      </exclusions>
    </dependency>-->
    <dependency>
      <groupId>org.apache.carbondata</groupId>
      <artifactId>carbondata-bloom</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-hive-thriftserver_${scala.binary.version}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-repl_${scala.binary.version}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-om_${scala.binary.version}</artifactId>
      <version>${spark.version}</version>
      <scope>${spark.deps.scope}</scope>
      <exclusions>
        <exclusion>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-streaming_${scala.binary.version}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-core_${scala.binary.version}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-sql_${scala.binary.version}</artifactId>
      <exclusions>
        <!-- from transitive dependency com.univocity:univocity-parsers:2.5.9
        is added from the org.apache.spark:spark-sql_2.11,so need to remove
        this version.Carbon uses 2.2.1 version  -->
        <exclusion>
          <groupId>com.univocity</groupId>
          <artifactId>univocity-parsers</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-sql-kafka-0-10_${scala.binary.version}</artifactId>
      <exclusions>
        <exclusion>
          <groupId>net.jpountz.lz4</groupId>
          <artifactId>lz4</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_${scala.binary.version}</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-aws</artifactId>
      <version>${hadoop.version}</version>
      <exclusions>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-annotations</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>net.java.dev.jets3t</groupId>
      <artifactId>jets3t</artifactId>
      <version>0.9.0</version>
    </dependency>
  </dependencies>

  <build>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <resources>
      <resource>
        <directory>src/resources</directory>
      </resource>
      <resource>
        <directory>.</directory>
        <includes>
          <include>CARBON_SPARK_INTERFACELogResource.properties</include>
        </includes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
        <version>2.15.2</version>
        <executions>
          <execution>
            <id>compile</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <phase>compile</phase>
          </execution>
          <execution>
            <id>testCompile</id>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <phase>test</phase>
          </execution>
          <execution>
            <phase>process-resources</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18</version>
        <!-- Note config is repeated in scalatest config -->
        <configuration>
          <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
          <argLine>-Xmx3g -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=512m</argLine>
          <systemProperties>
            <java.awt.headless>true</java.awt.headless>
            <spark.carbon.hive.schema.store>${carbon.hive.based.metastore}</spark.carbon.hive.schema.store>
          </systemProperties>
          <failIfNoTests>false</failIfNoTests>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest-maven-plugin</artifactId>
        <version>1.0</version>
        <!-- Note config is repeated in surefire config -->
        <configuration>
          <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
          <junitxml>.</junitxml>
          <filereports>CarbonTestSuite.txt</filereports>
          <argLine> ${argLine} -ea -Xmx3g -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=512m
          </argLine>
          <stderr />
          <environmentVariables>
          </environmentVariables>
          <systemProperties>
            <java.awt.headless>true</java.awt.headless>
            <spark.carbon.hive.schema.store>${carbon.hive.based.metastore}</spark.carbon.hive.schema.store>
          </systemProperties>
        </configuration>
        <executions>
          <execution>
            <id>test</id>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>build-all</id>
      <properties>
        <spark.version>2.3.2-mrs-2.0</spark.version>
        <scala.binary.version>2.11</scala.binary.version>
        <scala.version>2.11.8</scala.version>
      </properties>
    </profile>
    <profile>
      <id>sdvtest</id>
      <properties>
        <maven.test.skip>true</maven.test.skip>
      </properties>
    </profile>
    <profile>
      <id>spark-2.1</id>
      <properties>
        <spark.version>2.3.2-mrs-2.0</spark.version>
        <scala.binary.version>2.11</scala.binary.version>
        <scala.version>2.11.8</scala.version>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>src/main/spark2.2</exclude>
                <exclude>src/main/spark2.3</exclude>
                <exclude>src/main/commonTo2.2And2.3</exclude>
              </excludes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
              <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/main/spark2.1</source>
                    <source>src/main/commonTo2.1And2.2</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>spark-2.2</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <spark.version>2.3.2-mrs-2.0</spark.version>
        <scala.binary.version>2.11</scala.binary.version>
        <scala.version>2.11.8</scala.version>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>src/main/spark2.1</exclude>
                <exclude>src/main/spark2.3</exclude>
              </excludes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
              <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/main/spark2.2</source>
                    <source>src/main/commonTo2.1And2.2</source>
                    <source>src/main/commonTo2.2And2.3</source>
                    <source>src/main/commonTo2.1And2.2</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>spark-2.3</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.carbondata</groupId>
          <artifactId>carbondata-cli</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
      <properties>
        <spark.version>2.3.2-mrs-2.0</spark.version>
        <scala.binary.version>2.11</scala.binary.version>
        <scala.version>2.11.8</scala.version>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>src/main/spark2.1</exclude>
                <exclude>src/main/spark2.2</exclude>
                <exclude>src/main/commonTo2.1And2.2</exclude>
              </excludes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
              <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/main/spark2.3</source>
                    <source>src/main/commonTo2.2And2.3</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
	<profile>
    <id>mrs</id>
    <dependencies>
      <dependency>
        <groupId>org.apache.carbondata</groupId>
        <artifactId>carbondata-cli</artifactId>
        <version>${project.version}</version>
      </dependency>
    </dependencies>
    <properties>
      <spark.version>2.3.2-mrs-2.0</spark.version>
      <scala.binary.version>2.11</scala.binary.version>
      <scala.version>2.11.8</scala.version>
    </properties>
    <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>src/main/spark2.1</exclude>
            <exclude>src/main/spark2.3</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/main/spark2.2</source>
                <source>src/main/commonTo2.1And2.2</source>
                <source>src/main/commonTo2.2And2.3</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    </build>
    </profile>
  </profiles>
</project>
