<?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>

    <groupId>pub.mgl</groupId>
    <artifactId>mgl-app-kernel</artifactId>
    <version>2025.7.1</version>

    <name>mgl-app-kernel</name>
    <url>https://mgl.pub</url>
    <developers>
        <developer>
            <id>hotpot</id>
            <name>hotpot</name>
            <email>i@mgl.ee</email>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>只用于本人及本人所参与的任何产品和项目使用，不用于任何第三方应用</name>
            <url>mgl.pub</url>
            <distribution>repo</distribution>
            <comments>person license</comments>
        </license>
    </licenses>

    <scm>
        <tag>mgl</tag>
        <url>https://mgl.pub/p/mgl-base</url>
        <developerConnection>https://mgl.pub/p/mgl-base</developerConnection>
    </scm>

    <organization>
        <name>MGL技术社区</name>
        <url>https://mgl.pub/</url>
    </organization>
    <description>多租户管理系统内核</description>

    <properties>
        <revision>2025.7.1</revision>
        <spring-boot.version>3.5.4</spring-boot.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>21</java.version>
        <mgl-base-bom.version>2025.7.1</mgl-base-bom.version>

        <therapi-javadoc.version>0.15.0</therapi-javadoc.version>
        <mapstruct-plus.version>1.5.0</mapstruct-plus.version>
        <lombok.version>1.18.38</lombok.version>

        <!-- 插件版本 -->
        <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
        <maven-war-plugin.version>3.4.0</maven-war-plugin.version>
        <maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
        <flatten-maven-plugin.version>1.7.2</flatten-maven-plugin.version>

        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>
        <maven-javadoc-plugin.vserion>3.8.0</maven-javadoc-plugin.vserion>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
    </properties>

    <profiles>
        <profile>
            <id>local</id>
            <properties>
                <!-- 环境标识，需要与配置文件的名称相对应 -->
                <profiles.active>local</profiles.active>
                <logging.level>info</logging.level>
                <monitor.username>mgl</monitor.username>
                <monitor.password>123456</monitor.password>
            </properties>
        </profile>
        <profile>
            <id>dev</id>
            <properties>
                <!-- 环境标识，需要与配置文件的名称相对应 -->
                <profiles.active>dev</profiles.active>
                <logging.level>info</logging.level>
                <monitor.username>mgl</monitor.username>
                <monitor.password>123456</monitor.password>
            </properties>
            <activation>
                <!-- 默认环境 -->
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <profiles.active>prod</profiles.active>
                <logging.level>warn</logging.level>
                <monitor.username>mgl</monitor.username>
                <monitor.password>123456</monitor.password>
            </properties>
        </profile>
    </profiles>

    <!-- 依赖声明 -->
    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>tech.mgl</groupId>
                <artifactId>mgl-base-bom</artifactId>
                <version>${mgl-base-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- common 的依赖配置-->
            <dependency>
                <groupId>pub.mgl</groupId>
                <artifactId>biz-common-bom</artifactId>
                <version>2025.7.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>pub.mgl</groupId>
                <artifactId>common-bom</artifactId>
                <version>2025.7.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>pub.mgl</groupId>
                <artifactId>system</artifactId>
                <version>2025.7.1</version>
            </dependency>
            <dependency>
                <groupId>pub.mgl</groupId>
                <artifactId>sso</artifactId>
                <version>2025.7.1</version>
            </dependency>

            <dependency>
                <groupId>pub.mgl</groupId>
                <artifactId>job</artifactId>
                <version>2025.7.1</version>
            </dependency>

            <dependency>
                <groupId>pub.mgl</groupId>
                <artifactId>generator</artifactId>
                <version>2025.7.1</version>
            </dependency>

            <dependency>
                <groupId>pub.mgl</groupId>
                <artifactId>demo</artifactId>
                <version>2025.7.1</version>
            </dependency>

            <!--  工作流模块  -->
            <dependency>
                <groupId>pub.mgl</groupId>
                <artifactId>workflow</artifactId>
                <version>2025.7.1</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <modules>
        <module>admin</module>
        <module>common</module>
        <module>biz-common</module>
        <module>extend</module>
        <module>modules</module>
    </modules>
    <packaging>pom</packaging>

    <build>
        <sourceDirectory>${basedir}/src/main/kotlin</sourceDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <!-- 关闭过滤 -->
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <!-- 引入所有 匹配文件进行过滤 -->
                <includes>
                    <include>application*</include>
                    <include>bootstrap*</include>
                    <include>banner*</include>
                </includes>
                <!-- 启用过滤 即该资源中的变量将会被过滤器中的值替换 -->
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <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.build.sourceEncoding}</encoding>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>com.github.therapi</groupId>
                            <artifactId>therapi-runtime-javadoc-scribe</artifactId>
                            <version>${therapi-javadoc.version}</version>
                        </path>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                        <path>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-configuration-processor</artifactId>
                            <version>${spring-boot.version}</version>
                        </path>
                        <path>
                            <groupId>io.github.linpeilie</groupId>
                            <artifactId>mapstruct-plus-processor</artifactId>
                            <version>${mapstruct-plus.version}</version>
                        </path>
                        <path>
                            <groupId>org.postgresql</groupId>
                            <artifactId>postgresql</artifactId>
                            <version>42.7.5</version>
                        </path>
                        <path>
                            <groupId>tech.mgl</groupId>
                            <artifactId>mgl-utils</artifactId>
                        </path>
                        <path>
                            <groupId>tech.mgl</groupId>
                            <artifactId>mgl-boot-modules-enum</artifactId>
                        </path>
<!--                        <path>-->
<!--                            <groupId>org.projectlombok</groupId>-->
<!--                            <artifactId>lombok-mapstruct-binding</artifactId>-->
<!--                            <version>${mapstruct-plus.lombok.version}</version>-->
<!--                        </path>-->
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <arg>-parameters</arg>
                        <!-- ✅ 这里传入 sourceDir -->
                        <arg>-Amodule.sourceDir=${project.basedir}/src/main/kotlin</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <!-- 单元测试使用 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                    <!-- 根据打包环境执行对应的@Tag测试方法 -->
                    <groups>${profiles.active}</groups>
                    <!-- 排除标签 -->
                    <excludedGroups>exclude</excludedGroups>
                </configuration>
            </plugin>
            <!-- 统一版本号管理 -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>${flatten-maven-plugin.version}</version>
                <configuration>
                    <updatePomFile>true</updatePomFile>
                    <flattenMode>resolveCiFriendliesOnly</flattenMode>
                </configuration>
                <executions>
                    <execution>
                        <id>flatten</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>flatten.clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.vserion}</version>
                <executions>
                    <execution>
                        <id>attach-javadoc</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <charset>UTF-8</charset>
                    <encoding>UTF-8</encoding>
                    <docencoding>UTF-8</docencoding>
                    <failOnError>false</failOnError>
                </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>
                        <goals>
                            <!-- <goal>jar</goal>-->
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>**/pub/**</exclude>
                        <exclude>**/tech/**</exclude>
                    </excludes>
                    <excludeResources>
                        true
                    </excludeResources>
                </configuration>
            </plugin>
            <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>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${central-publishing-maven-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>${deploy.account}</publishingServerId>
                    <autoPublish>true</autoPublish>
                    <excludeArtifacts>
                        <excludeArtifact>admin</excludeArtifact>
                        <excludeArtifact>extend</excludeArtifact>
                        <excludeArtifact>generator</excludeArtifact>
                        <excludeArtifact>job</excludeArtifact>
                        <excludeArtifact>demo</excludeArtifact>
                        <excludeArtifact>test</excludeArtifact>
                        <artifact>admin</artifact>
                        <artifact>extend</artifact>
                        <artifact>generator</artifact>
                        <artifact>job</artifact>
                        <artifact>demo</artifact>
                        <artifact>test</artifact>
                    </excludeArtifacts>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


