<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>cn.xuqiudong.basic</groupId>
    <artifactId>lcxm-generate-spring-boot-starter</artifactId>
    <version>1.0.1-2024</version>
    <packaging>jar</packaging>

    <name>lcxm-generate-spring-boot-starter</name>
    <description>基于velocity的从数据库到mybatis的相关代码生成</description>
    <url>https://gitee.com/basic-support/lcxm-generate-spring-boot-starter</url>

    <properties>
        <spring.boot.version>2.7.3</spring.boot.version>
        <lcxm-common.version>1.0.1</lcxm-common.version>
        <velocity.version>1.7</velocity.version>

        <!--system properties ↓ ↓ ↓-->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <project.encoding>UTF-8</project.encoding>
        <!--system properties ↑ ↑ ↑-->
        <!--maven plugin version ↓ ↓ ↓ -->
        <maven-compiler-plugin.version>3.9.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
        <!--将项目代码库中的代码发布到SCM的新版本   2.5.3-->
        <maven-release-plugin.version>3.0.0-M6</maven-release-plugin.version>
        <maven-javadoc-plugin.version>3.4.0</maven-javadoc-plugin.version>
        <!-- 此版本被spring-boot使用 当前2.6.7 中定义的为3.2.2 -->
        <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
        <!-- 打包时把源码打到本地 -->
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <!-- copy resources 3.2.0 报错  Input length = 1 -->
        <maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
        <!-- spring boot  跟springboot版本走-->
        <!--<spring-boot-maven-plugin.version>2.7.2</spring-boot-maven-plugin.version>-->
        <p3c-pmd.version>2.1.1</p3c-pmd.version>

        <spotbugs-maven-plugin.version>4.7.3.0</spotbugs-maven-plugin.version>
        <spotbugs.version>4.7.3</spotbugs.version>
        <!--maven plugin version ↑ ↑ ↑-->

        <!-- skip for  plugin  start ↓ ↓ ↓ -->
        <skip.spotbugs>false</skip.spotbugs>
        <!-- skip for  plugin  end   ↑ ↑ ↑ -->
    </properties>

    <!-- sonatype: 开源许可证声明 有很多不同的开源许可证 Apache Version2.0 表示别人可以直接商用你的开源项目而无任何版权问题 -->
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <!-- sonatype:开源地址 -->
    <scm>
        <connection>scm:git:ssh://git@gitee.com:basic-support/lcxm-generate-spring-boot-starter.git</connection>
        <developerConnection>scm:git:https://gitee.com/basic-support/lcxm-generate-spring-boot-starter.git</developerConnection>
        <url>https://gitee.com/basic-support/lcxm-generate-spring-boot-starter</url>
        <tag>HEAD</tag>
    </scm>

    <!--sonatype: Issue地址 -->
    <issueManagement>
        <system>git Issue</system>
        <url>https://gitee.com/basic-support/lcxm-generate-spring-boot-starter/issues</url>
    </issueManagement>

    <!--sonatype: 开发者信息 -->
    <developers>
        <developer>
            <name>vic.xu</name>
            <email>xuduochoua@163.com</email>
            <roles>
                <role>Developer</role>
            </roles>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <!--版本控制-->
    <dependencyManagement>
        <dependencies>
            <!-- SpringBoot依赖 -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>cn.xuqiudong.basic</groupId>
            <artifactId>lcxm-common</artifactId>
            <version>${lcxm-common.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>${velocity.version}</version>
            <scope>compile</scope>
            <exclusions>
                <!-- 此处引入commons-lang2.4 和commons-configuration引入的2.6 冲突 -->
                <exclusion>
                    <groupId>commons-lang</groupId>
                    <artifactId>commons-lang</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- 热部署 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional><!-- optional=true,依赖不会传递，该项目依赖devtools；之后依赖myboot项目的项目如果想要使用devtools，需要重新引入 -->
        </dependency>

        <!--默认引入mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- odbc ,如果需要则在项中手动引入 -->
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>

        <!-- 编译时生成spring-configuration-metadata.json  给IDE使用，作为提示-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-annotations</artifactId>
            <version>${spotbugs.version}</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <!-- 指定jdk和编码 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${project.encoding}</encoding>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <!-- 跳过测试 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <skipTests>true</skipTests>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
            </plugin>

            <!--打包时 把源码打包到本地 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- copy resources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
            </plugin>

            <!--打jar插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <inherited>true</inherited>
                <executions>
                    <execution>
                        <id>bundle-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <!--不进行doclint 检测-->
                            <doclint>none</doclint>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <source>${java.version}</source>
                    <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>-->
                    <!--<additionalJOption>-Xdoclint:none</additionalJOption>-->
                    <!-- 自定义tag https://maven.apache.org/plugins/maven-javadoc-plugin/examples/tag-configuration.html-->
                    <tags>
                        <tag>
                            <name>description</name>
                            <!-- description tag for all places -->
                            <placement>a</placement>
                            <head>description about class or method and so on</head>
                        </tag>
                        <tag>
                            <name>date</name>
                            <!-- date tag for all places -->
                            <placement>a</placement>
                            <head>create date:</head>
                        </tag>
                    </tags>

                </configuration>
            </plugin>


            <!--spotbugs 静态bug检测：https://spotbugs.readthedocs.io/en/stable/maven.html  -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs-maven-plugin.version}</version>
                <dependencies>
                    <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
                    <dependency>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs</artifactId>
                        <version>${spotbugs.version}</version>
                    </dependency>
                    <!-- 引入注解(如)https://mvnrepository.com/artifact/com.github.spotbugs/spotbugs-annotations -->
                    <dependency>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-annotations</artifactId>
                        <version>${spotbugs.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>check</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!--参见：所有 detector https://spotbugs.readthedocs.io/en/stable/detectors.html -->
                    <!-- FindNullDeref : It is a slow detector.-->
                    <omitVisitors>UnreadFields,FindReturnRef,FindNullDeref</omitVisitors>
                    <skip>${skip.spotbugs}</skip>
                </configuration>
            </plugin>


        </plugins>

    </build>

    <profiles>
        <profile>
            <!-- 上传的时候使用的配置和插件 -Pdeploy-->
            <id>deploy</id>
            <build>
                <plugins>
                    <!-- 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>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>

                    <!--  生成签名，确定使用那个gpg秘钥 -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>

                                    <!--本地生成了对个秘钥对，所以这里指定一个发布成功的秘钥  gpg -k-->
                                    <keyname>877B1FAE177412DFA451E73B6CF967DE5C1F7A9E</keyname>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
