<?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>com.github.admincaofuqiang</groupId>
    <artifactId>cfqutil</artifactId>
    <version>1.0</version>

    <name>cfqutil</name>
    <description>this is a project</description>
    <url>http://www.example.com</url>

    <!--licenses信息-->

    <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>

    <!--scm信息-->
    <scm>
        <url>https://github.com/caofqgit/</url>
        <connection>scm:git:https://github.com/caofqgit/cfqutil.git</connection>
        <developerConnection>scm:git:https://github.com/caofqgit/cfqutil.git</developerConnection>
    </scm>
    <!--发布者信息-->
    <developers>
        <developer>
            <name>caofuqiang</name>
            <email>caofuqiangmail@163.com</email>
            <organization>https://github.com/caofqgit</organization>
            <organizationUrl>https://github.com/caofqgit</organizationUrl>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <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://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>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</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>3.0.0</version>
                    <inherited>true</inherited>
                    <executions>
                        <execution>
                            <id>bundle-sources</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <maxmemory>1024</maxmemory>
                        <encoding>UTF-8</encoding>
                        <show>protected</show>
                        <notree>true</notree>

                        <!-- Avoid running into Java 8's very restrictive doclint issues -->
                        <failOnError>false</failOnError>
                        <doclint>none</doclint>
                    </configuration>
                </plugin>

                <!-- 9. 编译构建maven工程的插件 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <!-- 10. 确定要使用哪些插件 -->
        <plugins>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-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>
            <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>sonatype</id>
                                  <phase>verify</phase>
                                  <goals>
                                      <goal>sign</goal>
                                  </goals>
                              </execution>
                          </executions>
                      </plugin>
                  </plugins>
            </build>
        </profile>
    </profiles>

    <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>
</project>
