<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>top.dlzio</groupId>
        <artifactId>dlz.parent</artifactId>
        <version>6.6.3.4</version>
    </parent>
    <name>dlz-db</name>
	<artifactId>dlz-db</artifactId>
    <version>7.0.1-2</version>
	<packaging>pom</packaging>
    <description>DLZ-DB v7.0: 多模块数据库框架，支持 Spring 和 Solon</description>
    <properties>
        <java.version>1.8</java.version>
        <dlz-spring.version>6.6.5</dlz-spring.version>
        <dlz-kit.version>6.6.5</dlz-kit.version>
        <dlz-db.version>7.0.1-2</dlz-db.version>

        <!-- 代码质量工具版本 -->
        <jacoco.version>0.8.11</jacoco.version>
        <spotbugs.version>4.8.6</spotbugs.version>
        <spotbugs.maven.version>4.8.6.6</spotbugs.maven.version>
        <findsecbugs.version>1.12.0</findsecbugs.version>
        <checkstyle.version>9.3</checkstyle.version>
        <pmd.version>3.21.2</pmd.version>


        <solon.version>3.0.6</solon.version>
        <jedis.version>4.4.3</jedis.version>
        <sqlite.version>3.43.0.0</sqlite.version>
        
        <!-- 质量阈值 -->
        <jacoco.line.coverage>0.70</jacoco.line.coverage>
        <jacoco.branch.coverage>0.60</jacoco.branch.coverage>
    </properties>
    <modules>
        <module>dlz-db-core</module>
        <module>dlz-db-spring-boot-starter</module>
<!--        <module>spring-test-demo</module>-->
        <module>dlz-db-solon-plugin</module>
    </modules>
    <dependencies>
        <!-- Spring Boot -->
        <!-- 测试 -->
        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.9.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>5.9.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.24.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.12</version>
        </dependency>
    </dependencies>
    
    <build>
        <plugins>
            <!-- Maven Surefire 插件 - 覆盖父 POM 的 skip=true 配置 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <!-- 不跳过测试 -->
                    <skip>false</skip>
                    <skipTests>false</skipTests>
                    
                    <!-- 复用 JVM，避免每个测试类都重新初始化 Spring -->
                    <forkCount>1</forkCount>
                    <reuseForks>true</reuseForks>
                    
                    <!-- 保留 JaCoCo 的 argLine 参数 -->
                    <argLine>@{argLine} -Xmx1024m</argLine>
                    
                    <!-- 包含的测试 -->
                    <includes>
                        <include>**/*Test.java</include>
                        <include>**/*Tests.java</include>
                    </includes>
                </configuration>
            </plugin>

            <!-- JaCoCo 测试覆盖率 -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <configuration>
                    <outputDirectory>${project.build.directory}/reports/jacoco</outputDirectory>
                </configuration>
                <executions>
                    <!-- 为所有子模块准备JaCoCo agent -->
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <!-- 为所有子模块生成独立报告 -->
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- SpotBugs 静态分析 -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs.maven.version}</version>
                <configuration>
                    <effort>Max</effort>
                    <threshold>Low</threshold>
                    <xmlOutput>true</xmlOutput>
                    <htmlOutput>true</htmlOutput>
                    <failOnError>false</failOnError>
                    <outputDirectory>${project.build.directory}/reports/spotbugs</outputDirectory>
                    <excludeFilterFile>${project.basedir}/../spotbugs-exclude.xml</excludeFilterFile>
                    <plugins>
                        <plugin>
                            <groupId>com.h3xstream.findsecbugs</groupId>
                            <artifactId>findsecbugs-plugin</artifactId>
                            <version>${findsecbugs.version}</version>
                        </plugin>
                    </plugins>
                </configuration>
            </plugin>

            <!-- PMD 代码质量 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${pmd.version}</version>
                <configuration>
                    <failOnViolation>false</failOnViolation>
                    <printFailingErrors>true</printFailingErrors>
                    <targetJdk>1.8</targetJdk>
                    <outputDirectory>${project.build.directory}/reports/pmd</outputDirectory>
                </configuration>
            </plugin>

            <!-- OWASP Dependency-Check 依赖安全扫描 -->
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>9.0.9</version>
                <configuration>
                    <format>ALL</format>
                    <outputDirectory>${project.build.directory}/reports</outputDirectory>
                    <failBuildOnCVSS>7</failBuildOnCVSS>
                    <suppressionFile>reports/dependency-check-suppressions.xml</suppressionFile>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <!-- JaCoCo 聚合报告 Profile -->
    <profiles>
        <profile>
            <id>jacoco-aggregate</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco.version}</version>
                        <executions>
                            <execution>
                                <id>report-aggregate</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>report-aggregate</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/reports/jacoco-aggregate</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    
    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/dingkui/dlz-db</url>
        <connection>scm:git:https://github.com/dingkui/dlz-db.git</connection>
        <developerConnection>scm:git:https://github.com/dingkui/dlz-db.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>dk1983</id>
            <name>dingkui</name>
            <email>59461202@qq.com</email>
        </developer>
    </developers>
</project>