<?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>

  <packaging>pom</packaging>

  <groupId>top.csaf</groupId>
  <artifactId>ZUtil</artifactId>
  <version>2.0.0-alpha2</version>
  <name>${project.artifactId}</name>
  <url>https://github.com/duanluan/ZUtil</url>
  <description>Java Util</description>
  <licenses>
    <license>
      <name>Apache License 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/duanluan/ZUtil/issues</url>
  </issueManagement>
  <!-- 开发者：https://central.sonatype.org/publish/requirements/#developer-information -->
  <developers>
    <developer>
      <name>duanluan</name>
      <email>duanluan@outlook.com</email>
      <organization>计算机科学与艺术基金会（CSAF）</organization>
      <organizationUrl>https://github.com/csa-f</organizationUrl>
      <timezone>+8</timezone>
    </developer>
  </developers>
  <!-- SCM：https://central.sonatype.org/publish/requirements/#scm-information -->
  <scm>
    <url>https://github.com/duanluan/ZUtil/tree/main</url>
    <connection>scm:git:git://github.com/duanluan/ZUtil.git</connection>
    <developerConnection>scm:git:ssh://github.com:duanluan/ZUtil.git</developerConnection>
  </scm>

  <properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jacocoArgLine/>
    <serverId>central</serverId>
  </properties>

  <modules>
    <module>zutil-all</module>
    <module>zutil-core</module>
    <module>zutil-regex</module>
    <module>zutil-io</module>
    <module>zutil-pinyin</module>
    <module>zutil-date</module>
  </modules>

  <dependencies>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.30</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.36</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.7.36</version>
    </dependency>

    <!-- JUnit：https://junit.org/junit5/docs/current/api/index.html -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.10.0</version>
      <scope>test</scope>
    </dependency>
    <!-- JUnit 测试套件 -->
    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-suite</artifactId>
      <version>1.10.0</version>
      <scope>test</scope>
    </dependency>
    <!-- Spring Test，此处主要用于调用 private 方法用于覆盖率测试 -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>5.3.30</version>
      <scope>test</scope>
    </dependency>
    <!-- JMH -->
    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-core</artifactId>
      <version>1.37</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-generator-annprocess</artifactId>
      <version>1.37</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>cn.hutool</groupId>
      <artifactId>hutool-all</artifactId>
      <version>5.8.22</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <!-- Apache Maven Compiler Plugin：配置 compiler:compile、compiler:testCompile https://maven.apache.org/plugins/maven-compiler-plugin/index.html -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.10.1</version>
          <!-- compiler:compile https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html -->
          <configuration>
            <!-- Setting the -source and -target of the Java Compiler https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html -->
            <!-- Java 编译器的 -source 参数 https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#source -->
            <source>${java.version}</source>
            <!-- Java 编译器的 -target 参数 https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#target -->
            <target>${java.version}</target>
            <!-- 显示编译警告 https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#showWarnings -->
            <showWarnings>true</showWarnings>
          </configuration>
        </plugin>
        <!-- Apache Maven Surefire Plugin：配置 test 生命周期阶段 https://maven.apache.org/surefire/maven-surefire-plugin/ -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.2</version>
          <!-- surefire:test https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html -->
          <configuration>
            <!-- 忽略测试失败 https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#testFailureIgnore -->
            <testFailureIgnore>true</testFailureIgnore>
            <!-- 需排除的测试 https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#excludes -->
            <excludes>
              <!-- JMH 性能测试 -->
              <exclude>**/jmh/**</exclude>
            </excludes>
            <argLine>${jacocoArgLine}</argLine>
            <!-- 跳过测试 -->
            <skipTests>true</skipTests>
          </configuration>
        </plugin>

        <!--
          JaCoCo https://www.eclemma.org/jacoco/trunk/doc/maven.html
          如果想在覆盖率报告中显示行号，或者突出显示源代码，必须 debug 编译
          使用 maven-surefire-plugin 或 maven-fails-plugin 时，不能将 forkCount 设置为 0 或将 forkMode 设置为 never，因为这将阻止运行测试的 -javaagent 参数，导致无法记录覆盖率
        -->
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.11</version>
          <configuration>
            <!-- 指定包含 JaCoCo 代理的属性名 https://www.eclemma.org/jacoco/trunk/doc/prepare-agent-mojo.html#propertyName -->
            <!-- 使用 maven-surefire-plugin 时会覆盖 VM 参数，所以需要取名并配置到 maven-surefire-plugin 的 argLine 中 -->
            <propertyName>jacocoArgLine</propertyName>
          </configuration>
          <executions>
            <execution>
              <id>jacoco-initialize</id>
              <goals>
                <!-- 默认生命周期阶段为 initialize。此代理通过 VM 参数传递给测试程序，在执行阶段收集覆盖率信息，在结束时写入文件。https://www.eclemma.org/jacoco/trunk/doc/prepare-agent-mojo.html -->
                <goal>prepare-agent</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- Javadoc and Sources Attachments - The Central Repository Documentation https://central.sonatype.org/publish/publish-maven/#javadoc-and-sources-attachments -->
        <!-- Apache Maven Source Plugin：创建源码 jar https://maven.apache.org/plugins/maven-source-plugin/ -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <!-- 默认生命周期阶段为 package。其他插件绑定到它的生命周期阶段时，用 jar 会重复打包，jar-no-fork 可以避免 https://stackoverflow.com/a/10568004 -->
                <!-- https://maven.apache.org/plugins/maven-source-plugin/jar-no-fork-mojo.html -->
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <!-- Maven Javadoc Plugin：生成 Javadoc https://maven.apache.org/plugins/maven-javadoc-plugin/ -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.6.0</version>
          <configuration>
            <!-- 关闭 doclint，避免因为 Javadoc 格式问题导致构建失败 https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#doclint -->
            <doclint>none</doclint>
          </configuration>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <!-- 默认生命周期阶段为 package。用于创建 Javadoc jar https://maven.apache.org/plugins/maven-javadoc-plugin/jar-mojo.html -->
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- GPG Signed Components - The Central Repository Documentation https://central.sonatype.org/publish/publish-maven/#gpg-signed-components -->
        <!-- Apache Maven GPG Plugin：使用 GPG 对项目 Artifacts（发行版文件）进行签名 https://maven.apache.org/plugins/maven-gpg-plugin/ -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <goals>
                <!-- 签名项目 Artifact、POM、附加 artifacts（源码、Javadoc、本地 jar 等） https://maven.apache.org/plugins/maven-gpg-plugin/sign-mojo.html -->
                <goal>sign</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <!--&lt;!&ndash; 旧平台 Nexus Staging Maven Plugin for Deployment and Release - The Central Repository Documentation https://central.sonatype.org/publish/publish-maven/#nexus-staging-maven-plugin-for-deployment-and-release &ndash;&gt;-->
        <!--&lt;!&ndash; Nexus Staging Maven Plugin：Nexus 流程 https://github.com/sonatype/nexus-maven-plugins/tree/main/staging/maven-plugin &ndash;&gt;-->
        <!--<plugin>-->
        <!--  <groupId>org.sonatype.plugins</groupId>-->
        <!--  <artifactId>nexus-staging-maven-plugin</artifactId>-->
        <!--  <version>1.6.13</version>-->
        <!--  <extensions>true</extensions>-->
        <!--  <configuration>-->
        <!--    &lt;!&ndash; Maven setting.xml 中 <server> 的 ID，用于获取身份验证信息 https://github.com/sonatype/nexus-maven-plugins/tree/main/staging/maven-plugin#configuring-the-plugin &ndash;&gt;-->
        <!--    <serverId>ossrh</serverId>-->
        <!--    &lt;!&ndash; 目标 Nexus URL &ndash;&gt;-->
        <!--    <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>-->
        <!--    &lt;!&ndash; deploy、close、rc-close 执行成功后自动 release &ndash;&gt;-->
        <!--    <autoReleaseAfterClose>true</autoReleaseAfterClose>-->
        <!--  </configuration>-->
        <!--</plugin>-->
        <!-- 新平台 Publishing By Using the Maven Plugin：https://central.sonatype.org/publish/publish-portal-maven/ -->
        <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>0.4.0</version>
          <extensions>true</extensions>
          <configuration>
            <publishingServerId>central</publishingServerId>
            <tokenAuth>true</tokenAuth>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-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-javadoc-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
      </plugin>
      <!--<plugin>-->
      <!--  <groupId>org.sonatype.plugins</groupId>-->
      <!--  <artifactId>nexus-staging-maven-plugin</artifactId>-->
      <!--</plugin>-->
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <!-- id 和 settings.xml 中设置用户名、密码的保持一致 -->
  <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>-->
    <snapshotRepository>
      <id>central</id>
      <url>https://central.sonatype.com/</url>
    </snapshotRepository>
  </distributionManagement>

  <repositories>
    <!--<repository>-->
    <!--  <id>huaweicloud</id>-->
    <!--  <url>https://repo.huaweicloud.com/repository/maven/</url>-->
    <!--</repository>-->
    <!--<repository>-->
    <!--  <id>aliyunmaven</id>-->
    <!--  <url>https://maven.aliyun.com/repository/public</url>-->
    <!--</repository>-->
    <repository>
      <id>maven_central</id>
      <name>Maven Central</name>
      <url>https://repo.maven.apache.org/maven2/</url>
    </repository>
    <!-- jitpack -->
    <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>huaweicloud</id>
      <url>https://repo.huaweicloud.com/repository/maven/</url>
    </pluginRepository>
    <pluginRepository>
      <id>aliyunmaven</id>
      <url>https://maven.aliyun.com/repository/public</url>
    </pluginRepository>
    <pluginRepository>
      <id>maven_central</id>
      <url>https://repo.maven.apache.org/maven2/</url>
    </pluginRepository>
  </pluginRepositories>
</project>
