<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.yeepay.yop.sdk</groupId>
    <artifactId>yop-java-sdk-biz</artifactId>
    <packaging>jar</packaging>
    <name>yop-java-sdk-biz</name>
    <version>4.4.15</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <yop-java-sdk.version>4.4.15</yop-java-sdk.version>
        <maven.java.version>${java.version}</maven.java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>

        <junit-version>4.12</junit-version>
        <slf4j-api.version>1.7.21</slf4j-api.version>
    </properties>

    <dependencies>
        <!-- yop-basic-sdk -->
        <dependency>
            <groupId>com.yeepay.yop.sdk</groupId>
            <artifactId>yop-java-sdk</artifactId>
            <version>${yop-java-sdk.version}</version>
        </dependency>

        <!--  下方两个软算法包可以根据需要引入 -->
        <!--  1.国际软算法(RSA) -->
        <dependency>
            <groupId>com.yeepay.yop.sdk</groupId>
            <artifactId>yop-java-sdk-crypto-inter</artifactId>
            <version>${yop-java-sdk.version}</version>
        </dependency>
        <!--  2.商密软算法(SM2) -->
        <dependency>
            <groupId>com.yeepay.yop.sdk</groupId>
            <artifactId>yop-java-sdk-crypto-gm</artifactId>
            <version>${yop-java-sdk.version}</version>
        </dependency>

        <!-- test lib -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j-api.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <!--阿里云仓库 -->
        <repository>
            <id>aliyun</id>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        </repository>
        <!--快照版本使用,正式版本无需添加此仓库 -->
        <repository>
            <id>snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>nexus</id>
            <url>http://116.62.59.245:8081/nexus/content/groups/public/</url>
        </repository>
        <repository>
            <id>nexus-releases</id>
            <url>http://116.62.59.245:8081/nexus/content/repositories/releases/</url>
        </repository>
        <repository>
            <id>nexus-snapshots</id>
            <url>http://116.62.59.245:8081/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <!-- 构建分发地址 -->
    <distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <url>http://116.62.59.245:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <url>http://116.62.59.245:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <configuration>
                    <excludes>
                        <exclude>*.p12</exclude>
                        <exclude>*.pfx</exclude>
                        <exclude>cer/*</exclude>
                        <exclude>config/*</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

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

            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <excludes>
                        <exclude>config/*</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <!-- shaded别名 -->
                            <shadedClassifierName>shade</shadedClassifierName>
                            <!-- 将所有不使用的类全部排除掉(该插件会误删一些类，暂时不瘦身) -->
                            <!-- <minimizeJar>true</minimizeJar> -->
                            <artifactSet>
                                <excludes>
                                    <exclude>org.bouncycastle:*</exclude>
                                </excludes>
                            </artifactSet>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/spring.*</exclude>
                                        <exclude>META-INF/web-fragment.xml</exclude>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                        <exclude>mozilla/*</exclude>
                                        <exclude>rebel.xml</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <relocations>
                                <relocation>
                                    <pattern>com.fasterxml</pattern>
                                    <shadedPattern>com.yeepay.shade.com.fasterxml</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.google</pattern>
                                    <shadedPattern>com.yeepay.shade.com.google</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>javax.annotation</pattern>
                                    <shadedPattern>com.yeepay.shade.javax.annotation</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.apache</pattern>
                                    <shadedPattern>com.yeepay.shade.org.apache</shadedPattern>
                                    <excludes>
                                        <exclude>org/apache/commons/logging/**</exclude>
                                    </excludes>
                                </relocation>
                                <relocation>
                                    <pattern>org.joda</pattern>
                                    <shadedPattern>com.yeepay.shade.org.joda</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.springframework</pattern>
                                    <shadedPattern>com.yeepay.shade.org.springframework</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.checkerframework</pattern>
                                    <shadedPattern>com.yeepay.shade.org.checkerframework</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.jayway</pattern>
                                    <shadedPattern>com.yeepay.shade.com.jayway</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>net.minidev</pattern>
                                    <shadedPattern>com.yeepay.shade.net.minidev</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.objectweb.asm</pattern>
                                    <shadedPattern>com.yeepay.shade.org.objectweb.asm</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.alibaba.csp.sentinel</pattern>
                                    <shadedPattern>com.yeepay.shade.com.alibaba.csp.sentinel</shadedPattern>
                                </relocation>
                            </relocations>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
