﻿<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>4.0.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <groupId>io.gitee.smartunity</groupId>
    <artifactId>rocks-platform</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <name>Rocks Platform</name>
    <description>Rocks 开发底座框架 - 父工程</description>
    <url>https://gitee.com/smartunity/rocks</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>smartunity</id>
            <name>applebear</name>
            <email>kakilu@vip.qq.com</email>
        </developer>
    </developers>

    <scm>
        <url>https://gitee.com/smartunity/rocks</url>
        <connection>scm:git:https://gitee.com/smartunity/rocks.git</connection>
        <developerConnection>scm:git:https://gitee.com/smartunity/rocks.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <!-- ============================================================ -->
    <!-- 子模块 -->
    <!-- ============================================================ -->
    <modules>
        <module>rocks-dependencies</module>
        <module>rocks-common</module>
        <module>rocks-db-adaptor</module>
        <module>rocks-cache-adaptor</module>
        <module>rocks-job-adaptor</module>
        <module>rocks-mq-adaptor</module>
        <module>rocks-auth</module>
        <module>rocks-perm</module>
        <module>rocks-flow</module>
        <module>rocks-builder</module>
        <module>rocks-log</module>
        <module>rocks-sight</module>
        <module>rocks-api</module>
        <module>rocks-spring-boot-starter</module>
        <module>rocks-spring-boot-starter-auth</module>
        <module>rocks-spring-boot-starter-flow</module>
        <module>rocks-starter</module>
        <module>rocks-samples-leave</module>
        <module>rocks-starter-verify</module>
        <module>rocks-app</module>
    </modules>

    <!-- ============================================================ -->
    <!-- 通用属性 -->
    <!-- ============================================================ -->
    <properties>
        <!-- 父 POM 不发布到 Maven Central -->
        <maven.deploy.skip>true</maven.deploy.skip>

        <!-- Java (由 spring-boot-starter-parent 管理) -->
        <java.version>21</java.version>

        <!-- Rocks 自身版本 -->
        <rocks.version>1.0.0</rocks.version>

        <!-- 代码质量插件版本 -->
        <checkstyle.version>10.21.4</checkstyle.version>
        <spotbugs.version>4.9.8</spotbugs.version>
        <spotbugs-maven-plugin.version>4.9.2.0</spotbugs-maven-plugin.version>

        <!-- 工具库版本（供子模块 annotationProcessorPaths 等场景引用） -->
        <lombok.version>1.18.36</lombok.version>
        <mapstruct.version>1.6.3</mapstruct.version>
        <testcontainers.version>1.20.6</testcontainers.version>
    </properties>

    <!-- ============================================================ -->
    <!-- 依赖管理：引入 rocks-dependencies BOM -->
    <!-- ============================================================ -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.gitee.smartunity</groupId>
                <artifactId>rocks-dependencies</artifactId>
                <version>${rocks.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>${testcontainers.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- MapStruct（子模块共用版本管理） -->
            <dependency>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct</artifactId>
                <version>${mapstruct.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- ============================================================ -->
    <!-- 构建配置（spring-boot-starter-parent 已管理 compiler/surefire） -->
    <!-- ============================================================ -->
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- ============================================= -->
                <!-- Checkstyle 代码风格检查 -->
                <!-- ============================================= -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>3.6.0</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <configLocation>checkstyle/checkstyle.xml</configLocation>
                        <suppressionsLocation>checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>false</failsOnError>
                        <violationSeverity>warning</violationSeverity>
                    </configuration>
                    <executions>
                        <execution>
                            <id>checkstyle</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- ============================================= -->
                <!-- SpotBugs 静态分析 -->
                <!-- ============================================= -->
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>${spotbugs-maven-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.github.spotbugs</groupId>
                            <artifactId>spotbugs</artifactId>
                            <version>${spotbugs.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <effort>Max</effort>
                        <threshold>Low</threshold>
                        <failOnError>false</failOnError>
                        <includeTests>true</includeTests>
                        <excludeFilterFile>checkstyle/spotbugs-exclude.xml</excludeFilterFile>
                    </configuration>
                    <executions>
                        <execution>
                            <id>spotbugs</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.9.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <deploymentName>rocks-platform</deploymentName>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <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>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <doclint>none</doclint>
                            <failOnError>false</failOnError>
                            <quiet>true</quiet>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.7</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
