<?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>
        <groupId>com.alipay.sofa</groupId>
        <artifactId>sofaboot-dependencies</artifactId>
        <version>2.6.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>rpc-sofa-boot-starter</artifactId>
    <version>5.5.2</version>

    <url>https://github.com/alipay/sofa-rpc</url>

    <properties>
        <java.version>1.6</java.version>
        <project.build.encoding>UTF-8</project.build.encoding>
        <skipTests>false</skipTests>
        <rpc.starter.version>5.5.2</rpc.starter.version>
        <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
        <license-maven-plugin.version>3.0</license-maven-plugin.version>
        <maven-java-formatter-plugin.version>0.4</maven-java-formatter-plugin.version>
        <maven-surefire-plugin.version>2.16</maven-surefire-plugin.version>
        <sofa-version-maven-plugin.version>1.0.1</sofa-version-maven-plugin.version>
        <jacoco-maven-plugin.version>0.7.9</jacoco-maven-plugin.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>com.alipay.sofa</groupId>
            <artifactId>rpc-sofa-boot-core</artifactId>
            <version>${rpc.starter.version}</version>
        </dependency>

        <dependency>
            <groupId>com.alipay.sofa</groupId>
            <artifactId>healthcheck-sofa-boot-starter</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>com.alipay.sofa</groupId>
            <artifactId>infra-sofa-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <!--切记:这里一定要添加,保证你的工程目录下的资源会被打包进入jar-->
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>${user.dir}</directory>
                <includes>
                    <include>LICENSE</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${project.build.encoding}</encoding>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license-maven-plugin.version}</version>
                <executions>
                    <!-- https://github.com/mycila/license-maven-plugin#maven-license-plugin -->
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <!-- among available goals remove, format, check, help  -->
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!-- session.executionRootDirectory resolves properly even with nested modules -->
                    <header>${user.dir}/tools/codestyle/HEADER</header>
                    <includes>
                        <include>**/src/main/java/**</include>
                        <include>**/src/test/java/**</include>
                    </includes>
                    <strictCheck>true</strictCheck>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                    </mapping>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.googlecode.maven-java-formatter-plugin</groupId>
                <artifactId>maven-java-formatter-plugin</artifactId>
                <version>${maven-java-formatter-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <configFile>${user.dir}/tools/codestyle/formatter.xml</configFile>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <skipTests>${skipTests}</skipTests>
                    <includes>
                        <!-- 这里需要根据自己的需要指定要跑的单元测试 -->
                        <include>**/*Test.java</include>
                    </includes>
                    <testFailureIgnore>false</testFailureIgnore>
                    <reuseForks>false</reuseForks>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.alipay.sofa</groupId>
                <artifactId>sofa-version-maven-plugin</artifactId>
                <version>${sofa-version-maven-plugin.version}</version>
                <configuration>
                    <dotGitDirectory>../.git</dotGitDirectory>
                    <defaultPropertiesFileEntries>
                        <Doc-Url>https://www.cloud.alipay.com/docs/2/56207</Doc-Url>
                    </defaultPropertiesFileEntries>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>gen</goal>
                            <goal>write</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <configuration>
                    <skip>false</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jdk8</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <properties>
                <maven.javadoc.failOnError>false</maven.javadoc.failOnError>
                <maven.javadoc.quiet>true</maven.javadoc.quiet>
            </properties>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.4</version>
                        <configuration>
                            <encoding>${project.build.sourceEncoding}</encoding>
                            <detectOfflineLinks>true</detectOfflineLinks>
                            <breakiterator>true</breakiterator>
                            <author>false</author>
                            <keywords>true</keywords>
                            <quiet>true</quiet>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.7</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>

        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                    <id>maven-snapshot</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                    <id>maven-snapshot</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
</project>
