<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>

    <groupId>top.charles7c</groupId>
    <artifactId>continew-admin</artifactId>
    <version>${revision}</version>
    <packaging>pom</packaging>

    <name>${project.artifactId}</name>
    <description>ContiNew Admin 中后台管理框架（孵化中），Continue New Admin，持续以最新流行技术栈构建。</description>
    <url>https://github.com/Charles7c/continew-admin</url>

    <modules>
        <module>continew-admin-webapi</module>
        <module>continew-admin-monitor</module>
        <module>continew-admin-system</module>
        <module>continew-admin-common</module>
    </modules>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.7</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <sa-token.version>1.33.0</sa-token.version>

        <!-- ### 持久层相关 ### -->
        <mybatis-plus.version>3.5.3.1</mybatis-plus.version>
        <dynamic-ds.version>3.6.1</dynamic-ds.version>
        <p6spy.version>3.9.1</p6spy.version>

        <!-- ### 工具库相关 ### -->
        <ip2region.version>2.7.6</ip2region.version>
        <knife4j.version>4.0.0</knife4j.version>
        <redisson.version>3.19.0</redisson.version>
        <easy-captcha.version>1.6.2</easy-captcha.version>
        <hutool.version>5.8.11</hutool.version>

        <!-- ### 基础环境相关 ### -->
        <revision>0.0.1-SNAPSHOT</revision>
        <java.version>1.8</java.version>
        <spotless.version>2.28.0</spotless.version>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <!-- 全局依赖版本管理 -->
    <dependencyManagement>
        <dependencies>
            <!-- ################ Sa-Token 相关 ################ -->
            <!-- Sa-Token（轻量级 Java 权限认证框架，让鉴权变得简单、优雅） -->
            <dependency>
                <groupId>cn.dev33</groupId>
                <artifactId>sa-token-spring-boot-starter</artifactId>
                <version>${sa-token.version}</version>
            </dependency>

            <!-- Sa-Token 整合 JWT -->
            <dependency>
                <groupId>cn.dev33</groupId>
                <artifactId>sa-token-jwt</artifactId>
                <version>${sa-token.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>cn.hutool</groupId>
                        <artifactId>hutool-jwt</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- ################ 持久层相关 ################ -->
            <!-- MyBatis Plus（MyBatis 的增强工具，在 MyBatis 的基础上只做增强不做改变，简化开发、提高效率） -->
            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-boot-starter</artifactId>
                <version>${mybatis-plus.version}</version>
            </dependency>

            <!-- Dynamic Datasource（基于 Spring Boot 的快速集成多数据源的启动器） -->
            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
                <version>${dynamic-ds.version}</version>
            </dependency>

            <!-- P6Spy（SQL 性能分析组件） -->
            <dependency>
                <groupId>p6spy</groupId>
                <artifactId>p6spy</artifactId>
                <version>${p6spy.version}</version>
            </dependency>

            <!-- ################ 工具库相关 ################ -->
            <!-- 第三方封装 Ip2region（离线 IP 数据管理框架和定位库，支持亿级别的数据段，10 微秒级别的查询性能，提供了许多主流编程语言的 xdb 数据管理引擎的实现） -->
            <dependency>
                <groupId>net.dreamlu</groupId>
                <artifactId>mica-ip2region</artifactId>
                <version>${ip2region.version}</version>
            </dependency>

            <!-- Knife4j（前身是 swagger-bootstrap-ui，集 Swagger2 和 OpenAPI3 为一体的增强解决方案） -->
            <dependency>
                <groupId>com.github.xiaoymin</groupId>
                <artifactId>knife4j-dependencies</artifactId>
                <version>${knife4j.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Redisson（不仅仅是一个 Redis Java 客户端） -->
            <dependency>
                <groupId>org.redisson</groupId>
                <artifactId>redisson-spring-boot-starter</artifactId>
                <version>${redisson.version}</version>
            </dependency>

            <!-- Easy Captcha（Java 图形验证码，支持 gif、中文、算术等类型，可用于 Java Web、JavaSE 等项目） -->
            <dependency>
                <groupId>com.github.whvcse</groupId>
                <artifactId>easy-captcha</artifactId>
                <version>${easy-captcha.version}</version>
            </dependency>

            <!-- Hutool（小而全的 Java 工具类库，通过静态方法封装，降低相关 API 的学习成本，提高工作效率，使 Java 拥有函数式语言般的优雅，让 Java 语言也可以“甜甜的”） -->
            <dependency>
                <groupId>cn.hutool</groupId>
                <artifactId>hutool-all</artifactId>
                <version>${hutool.version}</version>
            </dependency>

            <!-- ################ 本项目子模块相关 ################ -->
            <!-- API 模块（存放 Controller 层代码，打包部署的模块） -->
            <dependency>
                <groupId>top.charles7c</groupId>
                <artifactId>continew-admin-webapi</artifactId>
                <version>${project.version}</version>
            </dependency>

            <!-- 系统监控模块（存放系统监控模块相关功能，例如：日志管理、服务监控等） -->
            <dependency>
                <groupId>top.charles7c</groupId>
                <artifactId>continew-admin-monitor</artifactId>
                <version>${project.version}</version>
            </dependency>

            <!-- 系统管理模块（存放系统管理模块相关功能，例如：部门管理、角色管理、用户管理等） -->
            <dependency>
                <groupId>top.charles7c</groupId>
                <artifactId>continew-admin-system</artifactId>
                <version>${project.version}</version>
            </dependency>

            <!-- 公共模块（存放公共工具类，公共配置等） -->
            <dependency>
                <groupId>top.charles7c</groupId>
                <artifactId>continew-admin-common</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Hutool（小而全的 Java 工具类库，通过静态方法封装，降低相关 API 的学习成本，提高工作效率，使 Java 拥有函数式语言般的优雅，让 Java 语言也可以“甜甜的”） -->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
        </dependency>

        <!-- Lombok（在 Java 开发过程中用注解的方式，简化了 JavaBean 的编写，避免了冗余和样板式代码，让编写的类更加简洁） -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional> <!-- 表示依赖不会被传递 -->
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- 代码等格式化插件 -->
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.version}</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <java>
                        <importOrder>
                            <order>java,javax,lombok,io,org,com,cn,top.charles7c,</order>
                        </importOrder>
                        <removeUnusedImports/>
                        <eclipse>
                            <file>code-style/code-formatter.xml</file>
                        </eclipse>
                        <licenseHeader>
                            <file>code-style/license-header</file>
                        </licenseHeader>
                    </java>
                </configuration>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/**</include>
                </includes>
                <!-- 启用过滤，即替换对应资源中的变量 -->
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <!-- 自定义属性配置 -->
            <properties>
                <!-- Spring Boot 启用环境 -->
                <profiles.active>dev</profiles.active>
                <!-- 日志级别 -->
                <logging.level>DEBUG</logging.level>
                <!-- 日志存储位置 -->
                <logging.file.path>./logs</logging.file.path>
            </properties>
            <activation>
                <!-- 默认启用 -->
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <profiles.active>prod</profiles.active>
                <logging.level>INFO</logging.level>
                <logging.file.path>./logs</logging.file.path>
            </properties>
        </profile>
    </profiles>
</project>
