<?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>sql.db2</artifactId>
        <groupId>com.dtstack.flink</groupId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>sql.sink.db2</artifactId>
    <packaging>jar</packaging>

    <name>db2-sink</name>
    <url>http://maven.apache.org</url>

    <properties>
        <sql.sink.rdb.version>1.0-SNAPSHOT</sql.sink.rdb.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.dtstack.flink</groupId>
            <artifactId>sql.sink.rdb</artifactId>
            <version>${sql.sink.rdb.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <excludes>

                                </excludes>
                            </artifactSet>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <!-- here the phase you need -->
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <copy todir="${basedir}/../../plugins/db2sink">
                                    <fileset dir="target/">
                                        <include name="${project.artifactId}-${project.version}.jar"/>
                                    </fileset>
                                </copy>

                                <move file="${basedir}/../../plugins/db2sink/${project.artifactId}-${project.version}.jar"
                                      tofile="${basedir}/../../plugins/db2sink/${project.name}-${git.branch}.jar"/>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


</project>