<?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>com.github.kfcfans</groupId>
        <version>3.0.0</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>powerjob-official-processors</artifactId>
    <version>1.0.1</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>3.4.6</powerjob.worker.version>

        <!-- 全部 shade 化，避免依赖冲突 -->
        <fastjson.version>1.2.68</fastjson.version>
        <okhttp.version>3.14.9</okhttp.version>
        <guava.version>29.0-jre</guava.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>

        <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>com.github.kfcfans</groupId>
            <artifactId>powerjob-worker</artifactId>
            <version>${powerjob.worker.version}</version>
            <scope>provided</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>
    </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>
                    <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>
                        </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>