<?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.3.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.alipay.sofa</groupId>
    <artifactId>rpc-sofa-boot-starter</artifactId>
    <version>5.3.1</version>

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

    <properties>
        <java.version>1.6</java.version>
        <project.build.encoding>UTF-8</project.build.encoding>

        <resteasy.version>3.0.12.Final</resteasy.version>
        <curator.version>2.9.1</curator.version>
        <ark.plugin.name>sofarpc-ark-plugin</ark.plugin.name>
        <dubbo_version>2.4.10</dubbo_version>
        <cxf.version>3.0.14</cxf.version>

        <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
        <sonar.jacoco.itReportPath>target/jacoco-it.exec</sonar.jacoco.itReportPath>
        <sonar.jacoco.reportPath>target/jacoco-ut.exec</sonar.jacoco.reportPath>
        <jacoco.path>${project.build.directory}/jacoco-ut.exec</jacoco.path>
        <jacoco.skip>true</jacoco.skip>

        <skipTests>false</skipTests>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.alipay.sofa</groupId>
            <artifactId>sofa-rpc-all</artifactId>
            <version>5.3.1</version>
        </dependency>

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

        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-client</artifactId>
            <version>${curator.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-framework</artifactId>
            <version>${curator.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-recipes</artifactId>
            <version>${curator.version}</version>
        </dependency>

        <!-- resteasy -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>${resteasy.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>javassist</artifactId>
                    <groupId>javassist</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>slf4j-simple</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson-provider</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-netty4</artifactId>
            <version>${resteasy.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-validator-provider-11</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>jaxrs-api</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
            <version>${resteasy.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>2.2.5</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>javax.el</artifactId>
            <version>2.2.6</version>
        </dependency>

        <!--dubbo-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>dubbo</artifactId>
            <version>${dubbo_version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>javassist</artifactId>
                    <groupId>org.javassist</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>spring</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.101tec</groupId>
            <artifactId>zkclient</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.zookeeper</groupId>
                    <artifactId>zookeeper</artifactId>
                </exclusion>
            </exclusions>
            <version>0.10</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-core</artifactId>
            <version>${cxf.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>1.4.2.RELEASE</version>
            <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>3.3</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>3.0.1</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>3.0</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>0.4</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.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.9</version>
                <configuration>
                    <!--引入前面jacoco的属性变量定义 -->
                    <skip>${jacoco.skip}</skip>
                    <destFile>${jacoco.path}</destFile>
                    <dataFile>${jacoco.path}</dataFile>
                    <sessionId>jacoco_coverage</sessionId>
                    <excludes>
                        <exclude>com.alipay.boot.sofarpc.spring.*</exclude>
                        <exclude>com.alipay.sofa.*</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>pre-test</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.8.1</version>
                <configuration>
                    <skipTests>${skipTests}</skipTests>
                    <includes>
                        <!-- 这里需要根据自己的需要指定要跑的单元测试 -->
                        <include>**/*Test.java</include>
                    </includes>
                    <testFailureIgnore>false</testFailureIgnore>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.alipay.sofa</groupId>
                <artifactId>sofa-version-maven-plugin</artifactId>
                <version>1.0.1</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>com.alipay.sofa</groupId>
                <artifactId>sofa-ark-plugin-maven-plugin</artifactId>
                <version>0.1.0</version>
                <executions>
                    <execution>
                        <id>default-cli</id>
                        <goals>
                            <goal>ark-plugin</goal>
                        </goals>

                        <configuration>
                            <priority>2000</priority>
                            <pluginName>${ark.plugin.name}</pluginName>

                            <exported>
                                <packages>
                                    <package>com.alipay.sofa.rpc.api</package>
                                    <package>com.alipay.sofa.rpc.common</package>
                                    <package>com.alipay.sofa.rpc.ext</package>
                                    <package>com.alipay.sofa.rpc.message</package>
                                    <package>com.alipay.sofa.rpc.server</package>
                                    <package>com.alipay.sofa.rpc.base</package>
                                    <package>com.alipay.sofa.rpc.config</package>
                                    <package>com.alipay.sofa.rpc.filter</package>
                                    <package>com.alipay.sofa.rpc.module</package>
                                    <package>com.alipay.sofa.rpc.tracer</package>
                                    <package>com.alipay.sofa.rpc.bootstrap</package>
                                    <package>com.alipay.sofa.rpc.context</package>
                                    <package>com.alipay.sofa.rpc.invoke</package>
                                    <package>com.alipay.sofa.rpc.protocol</package>
                                    <package>com.alipay.sofa.rpc.transport</package>
                                    <package>com.alipay.sofa.rpc.client</package>
                                    <package>com.alipay.sofa.rpc.core</package>
                                    <package>com.alipay.sofa.rpc.listener</package>
                                    <package>com.alipay.sofa.rpc.proxy</package>
                                    <package>com.alipay.sofa.rpc.codec</package>
                                    <package>com.alipay.sofa.rpc.event</package>
                                    <package>com.alipay.sofa.rpc.log</package>
                                    <package>com.alipay.sofa.rpc.registry</package>
                                    <package>com.alipay.hessian.generic.model</package>
                                    <package>com.alibaba.dubbo</package>
                                    <package>org.I0Itec.zkclient</package>
                                    <package>javax.ws.rs</package>
                                </packages>
                            </exported>

                            <excludeGroupIds>
                                <excludeGroupId>org.springframework</excludeGroupId>
                                <excludeGroupId>org.springframework.boot</excludeGroupId>
                                <excludeGroupId>org.apache.tomcat.embed</excludeGroupId>
                            </excludeGroupIds>
                        </configuration>
                    </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>
    </profiles>
</project>
