<?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">

    <groupId>cn.itlym</groupId>
    <artifactId>shoulder-framework</artifactId>
    <version>1.2.1</version><!-- shoulder-version -->

    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>

    <!-- mvn versions:set -DnewVersion=1.0.1-RELEASE、mvn versions:commit、mvn versions:revert -->

    <!-- 简介: 方便统一编译打包发布的模块，仅配置无代码 -->
    <name>shoulder Build</name>
    <description>Modules to centralize common resources and configuration for shoulder Maven builds.</description>
    <url>https://doc.itlym.cn</url>

    <!-- 开源组织 -->
    <organization>
        <name>ChinaLym</name>
        <url>https://doc.itlym.cn</url>
    </organization>

    <!-- 模块 -->
    <modules>
        <!-- 依赖管理 -->
        <module>shoulder-dependencies</module>
        <!-- 各模块通用配置 -->
        <module>shoulder-parent</module>
        <!-- 基础模块 -->
        <module>shoulder-build</module>
        <!-- 骨架工程 -->
        <module>shoulder-archetype-simple</module>
    </modules>

    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <maven-javadoc-plugin.version>3.6.0</maven-javadoc-plugin.version>
        <jacoco.version>0.8.12</jacoco.version>
        <maven-source-plugin.version>3.3.0</maven-source-plugin.version>
        <versions-maven-plugin.version>2.7</versions-maven-plugin.version>
        <license-maven-plugin.version>2.2.0</license-maven-plugin.version>
        <clirr-maven-plugin.version>2.8</clirr-maven-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.14</nexus-staging-maven-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>

    </properties>

    <!--发布前检查编译测试无用依赖 mvn dependency:analyze-->
    <!--发布前检查依赖是否有新版本 mvn dependency:analyze-->

    <!-- 开发者 -->
    <!-- 开发者 -->
    <developers>
        <developer>
            <id>lym</id>
            <name>lym</name>
            <email>cn_lym@foxmail.com</email>
            <organization>${project.organization.name}</organization>
            <organizationUrl>${project.organization.url}</organizationUrl>
            <roles>
                <role>architect</role>
                <role>developer</role>
            </roles>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <issueManagement>
        <system>Github Issue</system>
        <url>https://github.com/ChinaLym/shoulder-framework/issues</url>
    </issueManagement>

    <!-- 版本控制，供其他插件使用 -->
    <scm>
        <connection>scm:git:git://github.com/ChinaLym/shoulder-framework.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/ChinaLym/shoulder-framework.git</developerConnection>
        <url>git@github.com:ChinaLym/shoulder-framework.git</url>
        <tag>${project.version}</tag>
    </scm>

    <!--开源许可协议采用 Apache 2.0 协议-->
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <!-- 阿里云仓库，国内会快很多 -->
    <!--<repositories>
        <repository>
            <id>aliyun</id>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    &lt;!&ndash; 阿里云仓库，国内会快很多 &ndash;&gt;
    <pluginRepositories>
        <pluginRepository>
            <id>aliyun-plugin</id>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>-->

    <distributionManagement>
<!--        私域仓库，已停止运行 -->
<!--        <snapshotRepository>-->
<!--            <id>nexus</id>-->
<!--            <url>http://mvn.itlym.cn/repository/maven-snapshots/</url>-->
<!--        </snapshotRepository>-->
<!--        <repository>-->
<!--            <id>nexus</id>-->
<!--            <url>http://mvn.itlym.cn/repository/maven-releases/</url>-->
<!--        </repository>-->
        <snapshotRepository>
            <id>oss</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>oss</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
        <site>
            <id>shoulder</id>
            <name>document</name>
            <url>https://doc.itlym.cn</url>
        </site>
    </distributionManagement>

    <!--<profiles>
        <profile>
            <id>release</id>-->
    <build>
        <pluginManagement>
            <plugins>
                <!-- GPG  发布插件 【注意：发布时要改成 verify 才能在发布前执行签名】 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>deploy</phase><!-- ACTIVE_WITH_verify -->
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>

            <!-- 单测覆盖率 -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/jacoco-report</outputDirectory>
                            <outputEncoding>UTF-8</outputEncoding>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- 测试覆盖率统计工具 -->
            <!-- <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>cobertura-maven-plugin</artifactId>
                 <configuration>
                     <format>html</format>
                     <encoding>utf-8</encoding>
                     <instrumentation>
                     </instrumentation>
                 </configuration>
             </plugin>-->

            <!-- maven 发布插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
            </plugin>

            <!-- 检测依赖库的开源许可协议，遵守开源协议 mvn license:aggregate-add-third-party -->
            <!--官网：http://www.mojohaus.org/license-maven-plugin/examples/example-thirdparty.html#Merge_licenses-->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license-maven-plugin.version}</version>
                <!--<executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            &lt;!&ndash; license-list 列出可用的 license &ndash;&gt;
                            &lt;!&ndash; add-third-party 检测单个项目中的 license &ndash;&gt;
                            &lt;!&ndash; aggregate-add-third-party 检测多模块项目的 license &ndash;&gt;
                            <goal>aggregate-add-third-party</goal>
                        </goals>
                    </execution>
                </executions>-->
                <!-- 修改默认配置（可选） -->
                <configuration>
                    <!-- 设置检测结果文件的存放目录 -->
                    <outputDirectory>${basedir}/target/generated-sources/license</outputDirectory>
                    <!-- 设置检测结果文件，默认是 txt 文件 -->
                    <thirdPartyFilename>LICENSE_THIRD_PARTY.csv</thirdPartyFilename>
                    <!-- 设置检测结果文件样式。默认 txt 不方便查看，csv 文件的样式可 Excel 中进行分析；模板为 FreeMarker -->
                    <fileTemplate>E:/files/code/git/shoulder/shoulder-framework/third-party-file.ftl</fileTemplate>
                    <!-- mvn 命令会下载 license 文件，国内经常会出现请求超时，默认超时时间是 5 秒，改为 10 秒 -->
                    <connectionRequestTimeout>10000</connectionRequestTimeout>
                    <connectTimeout>10000</connectTimeout>
                    <socketTimeout>10000</socketTimeout>
                    <!-- 有些依赖可能检测不到 license、或有误，或需要对某些模块的 license 自己指定，将该配置设置为 true -->
                    <!-- 默认配置在 ${basedir}/src/license/THIRD-PARTY.properties 文件中 -->
                    <useMissingFile>false</useMissingFile>
                    <!-- 跳过某些 groupId 的检测，如本项目的各个模块 -->
                    <excludedGroups>cn\.itlym</excludedGroups>
                    <!-- 由于不同依赖中使用的 license 名称不同，为便于分类管理，将同类合并。如将 Apache 系列的 license 都合并为 Apache -->
                    <licenseMerges>
                        <licenseMerge>Apache 2.0|ASL, version
                            2|http://www.apache.org/licenses/LICENSE-2.0.txt|http://asm.ow2.org/license.html|The
                            Apache License, Version 2.0|Apache License|Apache License Version 2|Apache License
                            Version 2.0|Apache Software License - Version 2.0|Apache 2.0 License|Apache License
                            2.0|ASL|Apache 2|Apache-2.0|the Apache License, ASL Version 2.0|The Apache Software
                            License, Version 2.0|Apache License, Version 2.0|Apache Public License 2.0
                        </licenseMerge>
                        <licenseMerge>BSD|The BSD 3-Clause License|The BSD License|Modified BSD License|New BSD
                            License|New BSD license|Two-clause BSD-style license|BSD licence|BSD New|The New BSD
                            License|BSD 3-Clause|BSD 3-clause
                        </licenseMerge>
                        <licenseMerge>MIT|MIT License|The MIT License</licenseMerge>
                        <licenseMerge>LGPL|LGPL, version 2.1|GNU Library or Lesser General Public License (LGPL)
                            V2.1|GNU Lesser General Public License (LGPL), Version 2.1|GNU Lesser General Public
                            License, Version 2.1|LGPL 2.1
                        </licenseMerge>
                        <licenseMerge>CDDL|CDDL+GPL|CDDL+GPL License|CDDL + GPLv2 with classpath exception|CDDL
                            License|CDDL 1.0|CDDL 1.1|COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version
                            1.0|Common Development and Distribution License (CDDL) v1.0
                        </licenseMerge>
                        <licenseMerge>EPL|Eclipse Public License - Version 1.0</licenseMerge>
                        <licenseMerge>GPL|GPL2 w/ CPE|GPLv2+CE|GNU General Public Library</licenseMerge>
                        <licenseMerge>MPL|MPL 1.1</licenseMerge>
                        <licenseMerge>Public Domain</licenseMerge>
                        <licenseMerge>Common Public License|Common Public License Version 1.0</licenseMerge>
                        <licenseMerge>CC0|CC0 1.0 Universal|Public Domain, per Creative Commons CC0</licenseMerge>
                        <licenseMerge>Unknown License|Unknown license</licenseMerge>
                    </licenseMerges>
                    <!-- failIfWarning 配合这两个属性使用 <includedLicenses> <excludedLicenses> -->
                    <!-- <includedLicenses> 表示白名单，license 一定要在这个列表中 -->
                    <!-- <excludedLicenses> 表示黑名单，这个列表中的 license 一定不能出现 -->
                    <!-- 设为 true。license 不在白名单中、或在黑名单中，将构建失败。结合这个功能，非常方便看出项目中是否有非法 license -->
                    <failIfWarning>true</failIfWarning>
                </configuration>
            </plugin>

<!--            dependency-mediator-maven-plugin 依赖冲突检查 -->

            <!-- 接口兼容性检测，避免发布接口的与之前版本不兼容 clirr:check 检查上个版本 -->
            <!-- 用来检查版本兼容性 https://www.mojohaus.org/clirr-maven-plugin/ 列出方法的参数类型和返回类型和类字段的删除 -->
            <!--不支持JDK8以上的版本 clirr failed: Invalid byte tag in constant pool: 18-->
            <!--<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>clirr-maven-plugin</artifactId>
                <version>${clirr-maven-plugin.version}</version>
            </plugin>-->

            <!-- 修改父模块的版本之后，进入父模块的pom所在路径执行mvn命令：mvn -N versions:update-child-modules,即可自动修改所有子模块中的版本号 -->
            <!--<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>${versions-maven-plugin.version}</version>
                <configuration>
                    <generateBackupPoms>false</generateBackupPoms>
                </configuration>
            </plugin>-->
            <plugin>
                <!--https://central.sonatype.com/publishing-->
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.8.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <waitMaxTime>3600</waitMaxTime>
                    <waitPollingInterval>10</waitPollingInterval>
                    <deploymentName>shoulder1.2</deploymentName>
<!--                    <autoPublish>true</autoPublish>-->
                </configuration>
            </plugin>
<!--            <plugin>-->
<!--                <groupId>org.sonatype.plugins</groupId>-->
<!--                <artifactId>nexus-staging-maven-plugin</artifactId>-->
<!--                <version>${nexus-staging-maven-plugin.version}</version>-->
<!--                <extensions>true</extensions>-->

<!--                <configuration>-->
<!--                    <serverId>oss</serverId>-->
<!--                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>-->
<!--                    &lt;!&ndash;国内发布网络容易超时，设置长一点，1小时&ndash;&gt;-->
<!--                    <stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>-->
<!--                    <stagingDescription>preRelease</stagingDescription>-->
<!--                    &lt;!&ndash; 目标仓库 &ndash;&gt;-->
<!--                    &lt;!&ndash;<stagingRepositoryId>1078</stagingRepositoryId>&ndash;&gt;-->
<!--                    &lt;!&ndash;<stagingDescription>preRelease</stagingDescription>&ndash;&gt;-->
<!--                </configuration>-->
<!--            </plugin>-->

<!--            检查 api 兼容性-->
<!--            <groupId>org.revapi</groupId>-->
<!--            <artifactId>revapi-maven-plugin</artifactId>-->
<!--            <groupId>com.github.siom79.japicmp</groupId>-->
<!--            <artifactId>japicmp-maven-plugin</artifactId>-->


        </plugins>
    </build>

</project>
