<?xml version="1.0" encoding="UTF-8"?>
<!--
  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. See accompanying LICENSE file.
-->
<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>com.aliyun.odps</groupId>
        <artifactId>cupid-spark-2.x</artifactId>
        <version>3.3.8-public</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <groupId>com.aliyun.odps</groupId>
    <artifactId>odps-spark-datasource_${scala.binary.version}</artifactId>
    <version>3.3.8-public</version>
    <packaging>jar</packaging>

    <properties>
        <sbt.project.name>datasource</sbt.project.name>
        <loghubb.client.version>0.6.3</loghubb.client.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.aliyun.openservices</groupId>
            <artifactId>loghub-client-lib</artifactId>
            <version>${loghubb.client.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>net.jpountz.lz4</groupId>
                    <artifactId>lz4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_${scala.binary.version}</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-streaming_${scala.binary.version}</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-unsafe_${scala.binary.version}</artifactId>
            <version>${spark.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.aliyun.odps</groupId>
            <artifactId>cupid-sdk</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-actors</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>alibaba</id>
            <dependencies>
                <dependency>
                    <groupId>com.alibaba.cdo</groupId>
                    <artifactId>timetunnel-clientng</artifactId>
                    <exclusions>
                        <exclusion>
                            <groupId>io.netty</groupId>
                            <artifactId>netty</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>public</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>scala-compile-first</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>scala-test-compile-first</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>attach-scaladocs</id>
                                <phase>site</phase>
                                <goals>
                                    <goal>doc-jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <excludes>
                                <exclude>**/org/apache/spark/streaming/tt/*</exclude>
                                <exclude>**/org/apache/spark/streaming/util/*</exclude>
                            </excludes>
                            <scalaVersion>${scala.version}</scalaVersion>
                            <recompileMode>incremental</recompileMode>

                            <args>
                                <arg>-unchecked</arg>
                                <arg>-deprecation</arg>
                                <arg>-feature</arg>
                            </args>
                            <jvmArgs>
                                <jvmArg>-Xms1024m</jvmArg>
                                <jvmArg>-Xmx1024m</jvmArg>
                                <jvmArg>-XX:PermSize=${PermGen}</jvmArg>
                                <jvmArg>-XX:MaxPermSize=${MaxPermGen}</jvmArg>
                            </jvmArgs>
                            <javacArgs>
                                <javacArg>-source</javacArg>
                                <javacArg>${java.version}</javacArg>
                                <javacArg>-target</javacArg>
                                <javacArg>${java.version}</javacArg>
                            </javacArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
