<?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>io.github.noonecanhearme</groupId>
    <artifactId>api-monitor-spring-boot-starter</artifactId>
    <version>1.0.2</version>
    <packaging>jar</packaging>

    <name>api-monitor-spring-boot-starter</name>
    <description>API监控组件，提供接口调用记录和火焰图生成功能</description>
    
    <!-- 许可证信息 -->
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    
    <!-- 开发者信息 -->
    <developers>
        <developer>
            <name>yandac</name>
            <email>a1042382132@qq.com</email>
            <organization>yandac</organization>
            <organizationUrl>https://github.com/noonecanhearme</organizationUrl>
        </developer>
    </developers>
    
    <!-- 源代码管理信息 -->
    <scm>
        <connection>scm:git:git://github.com/noonecanhearme/api-monitor-spring-boot-starter.git</connection>
        <developerConnection>scm:git:ssh://github.com/noonecanhearme/api-monitor-spring-boot-starter.git</developerConnection>
        <url>https://github.com/noonecanhearme/api-monitor-spring-boot-starter</url>
        <tag>HEAD</tag>
    </scm>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.15</version>
    </parent>

    <properties>
        <java.version>11</java.version>
        <maven.compiler.source>11</maven.compiler.source>        
        <maven.compiler.target>11</maven.compiler.target>
        <spring.boot.version>2.7.18</spring.boot.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- Spring Boot 核心依赖 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-data-redis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-data-redis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- 日志依赖 -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- 数据库驱动 -->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>



        <!-- 火焰图生成依赖 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.10.0</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.collections</groupId>
            <artifactId>eclipse-collections</artifactId>
            <version>11.1.0</version>
            <scope>provided</scope>
        </dependency>
        <!-- 确保使用javax.servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- 测试依赖 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>1.8.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>public</id>
            <name>public</name>
            <url>https://repo1.maven.org/maven2/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>release</id>
            <url>https://repo1.maven.org/maven2/</url>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <!-- 移除自动发布插件，改为手动上传模式 -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>11</source>
                    <target>11</target>
                    <compilerArgs>
                        <arg>-Xlint:unchecked</arg>
                        <arg>-Xlint:deprecation</arg>
                    </compilerArgs>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <argLine>-Dfile.encoding=UTF-8</argLine>
                    <systemPropertyVariables>
                        <file.encoding>UTF-8</file.encoding>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- 添加distributionManagement配置，确保文件路径格式正确 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <attach>false</attach>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
            <!-- 添加生成MD5和SHA1校验和的插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <createChecksum>true</createChecksum>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <!-- 添加distributionManagement配置，确保正确的文件路径格式 -->
    <distributionManagement>
        <repository>
            <id>central</id>
            <name>Sonatype Central Repository</name>
            <url>https://central.sonatype.com/api/v1/publisher</url>
        </repository>
    </distributionManagement>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- 使用antrun插件生成MD5和SHA1校验和文件 -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>create-checksums</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <checksum file="${project.build.directory}/${project.build.finalName}.jar" algorithm="MD5" fileext=".md5"/>
                                        <checksum file="${project.build.directory}/${project.build.finalName}.jar" algorithm="SHA-1" fileext=".sha1"/>
                                        <checksum file="${project.build.directory}/${project.build.finalName}-sources.jar" algorithm="MD5" fileext=".md5"/>
                                        <checksum file="${project.build.directory}/${project.build.finalName}-sources.jar" algorithm="SHA-1" fileext=".sha1"/>
                                        <checksum file="${project.build.directory}/${project.build.finalName}-javadoc.jar" algorithm="MD5" fileext=".md5"/>
                                        <checksum file="${project.build.directory}/${project.build.finalName}-javadoc.jar" algorithm="SHA-1" fileext=".sha1"/>
                                        <checksum file="${project.build.directory}/${project.build.finalName}.pom" algorithm="MD5" fileext=".md5"/>
                                        <checksum file="${project.build.directory}/${project.build.finalName}.pom" algorithm="SHA-1" fileext=".sha1"/>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    
    <!-- 发布说明：
         1. 已切换为手动上传模式
         2. 构建产物将生成在target目录，包含jar、sources.jar及其对应的签名文件(.asc)
         3. 请使用Sonatype Central UI或Nexus CLI工具手动上传构建产物
         4. 上传前请确保已完成GPG签名
    -->
</project>