<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>io.stoys</groupId>
        <artifactId>stoys-parent_2.12</artifactId>
        <version>0.2</version>
    </parent>
    <artifactId>stoys-spark-db_2.12</artifactId>

    <properties>
        <h2.version>1.4.200</h2.version>
        <mysql.version>8.0.25</mysql.version>
        <postgresql.version>42.2.20</postgresql.version>
    </properties>

    <dependencies>
        <!-- stoys -->
        <dependency>
            <groupId>io.stoys</groupId>
            <artifactId>stoys-spark_${scala.compat.version}</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.stoys</groupId>
            <artifactId>stoys-spark-test_${scala.compat.version}</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- spark -->
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_${scala.compat.version}</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_${scala.compat.version}</artifactId>
        </dependency>

        <!-- jdbc -->
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>javax.persistence-api</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql.version}</version>
        </dependency>

        <!-- test -->
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scala.compat.version}</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <configuration>
                    <artifactSet combine.children="append">
                        <includes>
                            <include>javax.persistence:*</include>
                            <!--<include>mysql:*</include>-->
                            <!--<include>org.postgresql:*</include>-->
                        </includes>
                    </artifactSet>
                    <relocations combine.children="append">
                        <relocation>
                            <pattern>mysql</pattern>
                            <shadedPattern>io.stoys.shaded.mysql</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>org.postgresql</pattern>
                            <shadedPattern>io.stoys.shaded.org.postgresql</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
