<?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>cn.itlym</groupId>
        <artifactId>shoulder-framework</artifactId>
        <version>0.3</version><!-- shoulder-version -->
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <artifactId>shoulder-parent</artifactId>

    <properties>
        <java.version>11</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.charset>${project.build.sourceEncoding}</maven.javadoc.charset>

        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>

        <mapstruct.version>1.3.1.Final</mapstruct.version>
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
        <findbugs-maven-plugin.version>3.0.5</findbugs-maven-plugin.version>
        <cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>

        <springdoc-openapi-maven-plugin.version>0.3</springdoc-openapi-maven-plugin.version>
        <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>

    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>cn.itlym</groupId>
                <artifactId>shoulder-dependencies</artifactId>
                <version>0.3</version><!-- shoulder-version -->
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>

        <!-- plugin management 以下插件子模块自动继承，不必引入 -->
        <pluginManagement>
            <plugins>

                <!-- compiler settings -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <!-- UTF8 coding -->
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>1.13</version>
                    <configuration>
                        <!-- config for license:aggregate-add-third-party -->
                        <outputDirectory>${project.basedir}</outputDirectory>
                        <thirdPartyFilename>LICENSE-3RD-PARTY</thirdPartyFilename>
                        <fileTemplate>/org/codehaus/mojo/license/third-party-file-groupByLicense.ftl</fileTemplate>
                        <useMissingFile>true</useMissingFile>
                        <missingFile>${project.basedir}/LICENSE-3RD-PARTY.properties</missingFile>
                        <aggregateMissingLicensesFile>${project.basedir}/LICENSE-3RD-PARTY.properties
                        </aggregateMissingLicensesFile>
                        <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>

                        <!-- config for license:aggregate-download-licenses -->
                        <aggregateDownloadLicenses.executeOnlyOnRootModule>true
                        </aggregateDownloadLicenses.executeOnlyOnRootModule>
                        <!--<licensesConfigFile>${project.basedir}/lic/config/licenses.xml</licensesConfigFile>-->
                        <licensesOutputFile>${project.basedir}/lic/licenses.xml</licensesOutputFile>
                        <licensesOutputDirectory>${project.basedir}/lic/licenses/</licensesOutputDirectory>

                        <!-- config for license:update-file-header -->
                        <licenseName>apache_v2</licenseName>
                        <inceptionYear>2020</inceptionYear>
                        <organizationName>shoulder</organizationName>
                        <projectName>shoulder-framework</projectName>
                        <roots>
                            <root>src/main/java</root>
                            <root>src/test/java</root>
                        </roots>
                        <includes>
                            <include>**/*.java</include>
                            <include>**/*.xml</include>
                            <include>**/*.sh</include>
                            <include>**/*.py</include>
                            <include>**/*.properties</include>
                            <include>**/*.sql</include>
                            <include>**/*.html</include>
                            <include>**/*.less</include>
                            <include>**/*.css</include>
                            <include>**/*.js</include>
                            <include>**/*.json</include>
                        </includes>
                        <extraExtensions>
                            <scala>java</scala>
                        </extraExtensions>
                        <canUpdateCopyright>true</canUpdateCopyright>
                        <canUpdateDescription>true</canUpdateDescription>
                        <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
                        <emptyLineAfterHeader>true</emptyLineAfterHeader>
                        <processStartTag>&lt;&lt;</processStartTag>
                        <processEndTag>&gt;&gt;</processEndTag>
                        <sectionDelimiter>==</sectionDelimiter>

                        <!-- config for mvn license:update-project-license -->
                        <licenseFile>${project.basedir}/LICENSE</licenseFile>
                    </configuration>
                </plugin>

                <!-- attach source into jar 打包加入源码 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <!-- let it work when mvn package -->
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Javadoc -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <encoding>${maven.javadoc.charset}</encoding>
                        <charset>${maven.javadoc.charset}</charset>
                        <docencoding>${maven.javadoc.charset}</docencoding>
                    </configuration>
                    <!-- settings -> build tool -> Maven -> Runner -> MAVEN_OPTS=-Dfile.encoding=UTF-8;JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8-->
                    <!--<tags>
                        <tag>
                            <name>Description</name>
                            <placement>a</placement>
                            <head>描述</head>
                        </tag>
                        <tag>
                            <name>return</name>
                            <placement>a</placement>
                            <head>返回值</head>
                        </tag>
                        <tag>
                            <name>param...</name>
                            <placement>a</placement>
                            <head>参数</head>
                        </tag>
                        <tag>
                            <name>date</name>
                            <placement>a</placement>
                            <head>时间</head>
                        </tag>
                        <tag>
                            <name>Date</name>
                            <placement>a</placement>
                            <head>时间</head>
                        </tag>
                    </tags>-->
                    <!--网络不佳，snapshot仅发布jar以提高快照发布速度-->
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <configuration>
                                <!-- 取消对源码中的doc参数注释等检查 3.x 之前为 additionalparam -->
                                <additionalJOption>-Xdoclint:none</additionalJOption>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <!-- GPG  maven中央仓库发布插件 -->
                <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>verify</phase><!-- gpg phase verify deploy -->
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- findbugs 检查代码问题 -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>findbugs-maven-plugin</artifactId>
                    <version>${findbugs-maven-plugin.version}</version>
                    <configuration>
                        <!--<excludeFilterFile>tools/findbugs/findbugs-exclude.xml</excludeFilterFile>-->
                        <threshold>High</threshold>
                        <effort>Default</effort>
                        <findbugsXmlOutput>true</findbugsXmlOutput>
                        <findbugsXmlOutputDirectory>target/site/findbugs</findbugsXmlOutputDirectory>
                    </configuration>
                </plugin>

                <!-- 单元测试配置 when mvn test -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <argLine>-Xms256m -Xmx256m -XX:PermSize=64m -XX:MaxPermSize=64m -Dfile.encoding=utf-8</argLine>
                        <includes>
                            <include>**/*TestSuite.java</include>
                        </includes>
                    </configuration>
                </plugin>


                <!-- cobertura 单元测试覆盖率插件 -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>cobertura-maven-plugin</artifactId>
                    <version>${cobertura-maven-plugin}</version>
                </plugin>

                <!-- 自动生成文档 支持 JSR-303 Bean Validation -->
                <plugin>
                    <groupId>org.springdoc</groupId>
                    <artifactId>springdoc-openapi-maven-plugin</artifactId>
                    <version>${springdoc-openapi-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <!--访问json格式文档的URL， 默认路径：*http://localhost:8080/v3/api-docs*-->
                        <apiDocsUrl>http://localhost:8080/v3/api-docs</apiDocsUrl>
                        <!--存放定义的路径, 默认为： openapi.json-->
                        <outputFileName>openApi.json</outputFileName>
                        <!--文档存放的绝对路径–默认为： ${project.build.directory}-->
                        <outputDir>${project.build.directory}</outputDir>
                    </configuration>
                </plugin>

                <!-- sonar 代码检查插件 -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.7.0.1746</version>
                </plugin>


                <!-- 管理版本号 mvn versions:set -DnewVersion=1.1-SNAPSHOT -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.7</version>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

</project>
