<?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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.gitee.xuqiudong</groupId>
    <artifactId>first-sona</artifactId>
    <version>1.0.0</version>
    <name>first-sona</name>
    <description>first-sona project </description>
    <!--001-->
    <url>https://gitee.com/xuqiudong/first-sona</url>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <java.version>1.8</java.version>
        <!-- 插件版本 -->
        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>2.19</maven-surefire-plugin.version>
        <mybatis-generator-maven-plugin.version>1.3.2</mybatis-generator-maven-plugin.version>
        <!-- 此版本被spring-boot使用 -->
        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
        <!-- 打包时把源码打到本地 -->
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <!-- copy resources -->
        <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
    </properties>


    <!--002-->
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <!-- 3. 源码仓库信息 -->
    <scm>
        <connection>scm:git:git@gitee.com:xuqiudong/first-sona.git</connection>
        <developerConnection>scm:git@gitee.com:xuqiudong/first-sona.git</developerConnection>
        <url>https://gitee.com/xuqiudong/first-sona/tree/master/</url>
    </scm>
    <!-- 4. 开发人员信息 -->
    <developers>
        <developer>
            <name>vic.xu</name>
            <email>xuduochoua@163.com</email>
            <organization>https://gitee.com/xuqiudong</organization>
            <timezone>+8</timezone>
        </developer>
    </developers>
    <!-- 005 打包到中央仓库的地址 -->
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <!--插件管理 -->
        <pluginManagement>
            <plugins>
                <!-- 6. 上传到sonatype的插件 -->
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.7</version>
                    <extensions>true</extensions>
                    <configuration>
                        <!-- 这里的id必须要和全局配置中的server一致 -->
                        <serverId>ossrh</serverId>
                        <!-- 这个地址，一定要和issue的评论中给出的地址一致！ -->
                        <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                        <!-- 如果希望发布后自动执行close和release操作，此处可以调整为true -->
                        <autoReleaseAfterClose>false</autoReleaseAfterClose>
                    </configuration>
                </plugin>

                <!-- 7. 上传源码的插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.1.0</version>
                    <inherited>true</inherited>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <excludeResources>true</excludeResources>
                        <useDefaultExcludes>true</useDefaultExcludes>
                    </configuration>
                </plugin>

                <!-- 8. 生成doc文档的插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9.1</version>
                    <inherited>true</inherited>
                    <executions>
                        <execution>
                            <id>bundle-sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <maxmemory>1024</maxmemory>
                        <encoding>UTF-8</encoding>
                        <show>protected</show>
                        <notree>true</notree>

                        <!-- Avoid running into Java 8's very restrictive doclint issues -->
                        <failOnError>true</failOnError>
                        <!-- 防止文档不规范报错 -->
                        <additionalparam>-Xdoclint:none</additionalparam>
                    </configuration>
                </plugin>

                <!-- 9. 编译构建maven工程的插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>


        <!-- 10. 确定要使用哪些插件 -->
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>gpg.passphrase</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <!-- 11. 生成签名，确定使用那个gpg秘钥 -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <!-- 必须和配置中的gpg校验id一致 -->
                                <!--<id>gpg</id>-->
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>vic.xu</keyname>
                                    <passphraseServerId>vic.xu</passphraseServerId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>