<?xml version="1.0" encoding="UTF-8"?>
<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">
    <parent>
        <artifactId>powerjob</artifactId>
        <groupId>tech.powerjob</groupId>
        <version>3.0.0</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>powerjob-official-processors</artifactId>
    <version>1.2.0</version>
    <packaging>jar</packaging>

    <properties>

        <mvn.shade.plugin.version>3.2.4</mvn.shade.plugin.version>

        <!-- 不会被打包的部分，scope 只能是 test 或 provide -->
        <junit.version>5.6.1</junit.version>
        <logback.version>1.2.3</logback.version>
        <powerjob.worker.version>4.1.0</powerjob.worker.version>
        <spring.jdbc.version>5.2.9.RELEASE</spring.jdbc.version>
        <h2.db.version>1.4.200</h2.db.version>
        <mysql.version>8.0.28</mysql.version>

        <!-- 全部 shade 化，避免依赖冲突 -->
        <fastjson.version>1.2.83</fastjson.version>
        <okhttp.version>3.14.9</okhttp.version>
        <guava.version>30.1.1-jre</guava.version>
        <commons.io.version>2.6</commons.io.version>
        <commons.lang.version>3.10</commons.lang.version>
    </properties>

    <dependencies>

        <!-- fastJson(used for serialization of DAG) -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>${fastjson.version}</version>
        </dependency>

        <!-- OKHttp -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>${okhttp.version}</version>
        </dependency>

        <!-- commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons.io.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons.lang.version}</version>
        </dependency>

        <!-- guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>

        <dependency>
            <groupId>tech.powerjob</groupId>
            <artifactId>powerjob-worker</artifactId>
            <version>${powerjob.worker.version}</version>
            <scope>provided</scope>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.jdbc.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Junit tests -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- log for test stage -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- h2 database -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.db.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>${mvn.shade.plugin.version}</version>
                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                    <minimizeJar>true</minimizeJar>
                    <relocations>
                        <relocation>
                            <pattern>okhttp3</pattern>
                            <shadedPattern>shade.powerjob.okhttp3</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>okio</pattern>
                            <shadedPattern>shade.powerjob.okio</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>org</pattern>
                            <shadedPattern>shade.powerjob.org</shadedPattern>
                            <excludes>
                                <exclude>org.slf4j.*</exclude>
                                <exclude>org.springframework.**</exclude>
                                <exclude>org.w3c.**</exclude>
                            </excludes>
                        </relocation>
                        <relocation>
                            <pattern>com.google</pattern>
                            <shadedPattern>shade.powerjob.com.google</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>com.alibaba</pattern>
                            <shadedPattern>shade.powerjob.com.alibaba</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>