<?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.easy4j</groupId>
    <artifactId>opencode-java-sdk</artifactId>
    <name>${project.groupId}:${project.artifactId}</name>
    <url>https://github.com/easy-4-java/${project.artifactId}</url>
    <description>OpenCode Java SDK - JDK 1.8 line</description>
    <version>1.0.x.20260730</version>
    <packaging>jar</packaging>

    <!-- 开源协议采用 Apache 2.0 协议 -->
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <!-- 源码仓库（SCM）信息 -->
    <scm>
        <connection>scm:git:https://github.com/easy-4-java/${project.artifactId}.git</connection>
        <developerConnection>scm:git:https://github.com/easy-4-java/${project.artifactId}.git</developerConnection>
        <url>https://github.com/easy-4-java/${project.artifactId}</url>
        <tag>${project.artifactId}</tag>
    </scm>

    <!-- 开发者信息 -->
    <developers>
        <developer>
            <name>Loong Wan</name>
            <email>hiwepy@gmail.com</email>
            <url>https://github.com/loong10k</url>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <!-- 制品发布仓库配置（distributionManagement） -->
    <distributionManagement>
        <repository>
            <id>2624322-release-6F6h6R</id>
            <url>https://packages.aliyun.com/6927b116e6c3e0425dbdf60d/maven/2624322-release-6f6h6r</url>
        </repository>
        <snapshotRepository>
            <id>2624322-snapshot-3EoOv3</id>
            <url>https://packages.aliyun.com/6927b116e6c3e0425dbdf60d/maven/2624322-snapshot-3eoov3</url>
        </snapshotRepository>
    </distributionManagement>

    <!-- 版本属性定义：Java 版本、依赖版本与 Maven 插件版本统一管理 -->
    <properties>
        <java.version>1.8</java.version>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.version>3.0</maven.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- Dependency versions -->
        <commons-exec.version>1.4.0</commons-exec.version>
        <commons-lang.version>2.6</commons-lang.version>
        <jackson.version>2.18.9</jackson.version>
        <junit-jupiter.version>5.11.4</junit-jupiter.version>
        <junit.version>4.13.2</junit.version>
        <lombok.version>1.18.46</lombok.version>
        <okhttp.version>4.12.0</okhttp.version>
        <okhttp3-extension.version>1.0.x.20260730</okhttp3-extension.version>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <slf4j.version>2.0.18</slf4j.version>
        <!-- Maven Plugin versions -->
        <maven-central-publishing-plugin.version>0.11.0</maven-central-publishing-plugin.version>
        <maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
        <maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>
        <maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
        <maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <maven-install-plugin.version>3.1.4</maven-install-plugin.version>
        <maven-jacoco-plugin.version>0.8.15</maven-jacoco-plugin.version>
        <maven-jar-plugin.version>3.5.0</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
        <maven-release-plugin.version>3.3.1</maven-release-plugin.version>
        <maven-resources-plugin.version>3.5.0</maven-resources-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
    </properties>


    <!-- 依赖版本统一管理（dependencyManagement） -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.github.easy4j</groupId>
                <artifactId>okhttp3-extension</artifactId>
                <version>${okhttp3-extension.version}</version>
            </dependency>
            <!-- For Jackson BOM -->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- For OkHttp BOM -->
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp-bom</artifactId>
                <version>${okhttp.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- For Lombok -->
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
            <!-- For Slf4j -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <!-- For Commons Exec -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-exec</artifactId>
                <version>${commons-exec.version}</version>
            </dependency>
            <!-- For Junit5 -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit-jupiter.version}</version>
            </dependency>
            <!-- For OkHttp -->
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
            <version>${okhttp.version}</version></dependency>
            <!-- For OkHttp -->
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp-sse</artifactId>
            <version>${okhttp.version}</version></dependency>
            <!-- For Jackson -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version></dependency>
            <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver -->
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>mockwebserver</artifactId>
                <scope>test</scope>
            <version>${okhttp.version}</version></dependency>
        </dependencies>
    </dependencyManagement>

    <!-- 项目依赖（dependencies） -->
    <dependencies>
        <dependency>
            <groupId>io.github.easy4j</groupId>
            <artifactId>okhttp3-extension</artifactId>
        </dependency>
        <!-- For OkHttp -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
        </dependency>
        <!-- For OkHttp -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp-sse</artifactId>
        </dependency>
        <!-- For Jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <!-- For Commons Exec -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
        </dependency>
        <!-- For Slf4j -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <!-- For Lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- For Junit5 -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!-- 构建配置（Build） -->
    <build>
        <pluginManagement>
            <plugins>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
                <plugin>
                    <!-- 清理插件：清理构建输出目录 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven-clean-plugin.version}</version>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
                <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>
                        <!-- 编译最大内存 -->
                        <maxmem>512M</maxmem>
                        <annotationProcessorPaths>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                                <version>${lombok.version}</version>
                            </path>
                        </annotationProcessorPaths>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-deploy-plugin -->
                <plugin>
                    <!-- 发布插件：将项目输出构件部署到远程仓库 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-enforcer-plugin -->
                <plugin>
                    <!-- 环境检查插件：代码编译前的环境监察 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>default-cli</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <phase>validate</phase>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <message>
                                                                                        You are running an older version of Maven. This application requires at least Maven ${maven.version}.
                                                                                </message>
                                        <version>[${maven.version}.0,)</version>
                                    </requireMavenVersion>
                                    <requireJavaVersion>
                                        <message>
                                                                                        You are running an older version of Java. This application requires at least JDK ${java.version}.
                                                                                </message>
                                        <version>[${java.version}.0,)</version>
                                    </requireJavaVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
                <plugin>
                    <!-- 签名插件：对制品进行 PGP 签名 -->
                    <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>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin -->
                <plugin>
                    <!-- 安装插件：将项目输出构件安装到本地仓库 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven-install-plugin.version}</version>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin -->
                <plugin>
                    <!-- 资源插件：复制主资源文件至主输出目录 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin.version}</version>
                    <configuration>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin -->
                <plugin>
                    <!-- 发布管理插件：版本发布与标签管理 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                    <configuration>
                        <tagNameFormat>v@{project.version}</tagNameFormat>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <useReleaseProfile>false</useReleaseProfile>
                        <releaseProfiles>release</releaseProfiles>
                        <goals>deploy</goals>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
                <plugin>
                    <!-- 源码插件：发布时自动将源码同时发布 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                    <configuration>
                        <attach>true</attach>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
                <plugin>
                    <!-- 单元测试插件：执行测试用例 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <skip>false</skip>
                        <skipTests>false</skipTests>
                        <argLine>-Xmx1024m -Dfile.encoding=UTF-8</argLine>
                        <additionalClasspathElements>
                            <additionalClasspathElement>${basedir}/target/test-classes</additionalClasspathElement>
                        </additionalClasspathElements>
                        <includes>
                            <include>**/*Test.java</include>
                        </includes>
                        <excludes>
                            <exclude>**/TestBean.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
                <plugin>
                    <!-- jar 包生成插件：创建项目 jar 包 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                    <configuration>
                        <skipIfEmpty>true</skipIfEmpty>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
                <plugin>
                    <!-- 文档插件：发布时自动生成 Javadoc 并发布 -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <charset>${project.build.sourceEncoding}</charset>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <docencoding>${project.build.sourceEncoding}</docencoding>
                        <failOnError>false</failOnError>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- https://mvnrepository.com/artifact/org.sonatype.central/central-publishing-maven-plugin -->
                <plugin>
                    <!-- 发布插件：将制品发布到 Maven Central Portal -->
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${maven-central-publishing-plugin.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <publishingServerId>central</publishingServerId>
                        <autoPublish>true</autoPublish>
                        <waitUntil>published</waitUntil>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>

            <!-- https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin -->
            <plugin>
                <!-- 覆盖率插件：生成覆盖率报告并校验测试覆盖率（目标 90%） -->
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${maven-jacoco-plugin.version}</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <haltOnFailure>false</haltOnFailure>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.90</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
            <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>
                    <!-- 保留方法参数名，支持 Spring MVC 按参数名绑定 -->
                    <parameters>true</parameters>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <maxmem>512M</maxmem>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- 构建 Profile 配置 -->
    <profiles>
        <profile>
            <id>disable-javadoc-doclint</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
    <properties>
        <!-- Dependency versions -->
        <additionalparam>-Xdoclint:none -Xlint:unchecked</additionalparam>
    </properties>

        </profile>
        <!-- 发布到 Maven Central Portal：mvn -Prelease deploy（GPG 签名 + 源码 + Javadoc + Central 发布插件） -->

        <profile>
            <id>release</id>
            <build>
                <plugins>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-enforcer-plugin -->
                    <plugin>
                        <!-- 环境检查插件：代码编译前的环境监察 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
                    <plugin>
                        <!-- 编译插件：编译主代码至主输出目录 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin -->
                    <plugin>
                        <!-- 资源插件：复制主资源文件至主输出目录 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
                    <plugin>
                        <!-- 单元测试插件：执行测试用例 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
                    <plugin>
                        <!-- jar 包生成插件：创建项目 jar 包 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
                    <plugin>
                        <!-- 源码插件：发布时自动将源码同时发布 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
                    <plugin>
                        <!-- 文档插件：发布时自动生成 Javadoc 并发布 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin -->
                    <plugin>
                        <!-- 安装插件：将项目输出构件安装到本地仓库 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-install-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
                    <plugin>
                        <!-- 签名插件：对制品进行 PGP 签名 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-deploy-plugin -->
                    <plugin>
                        <!-- 发布插件：将项目输出构件部署到远程仓库 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin -->
                    <plugin>
                        <!-- 发布管理插件：版本发布与标签管理 -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                    </plugin>

                    <!-- https://mvnrepository.com/artifact/org.sonatype.central/central-publishing-maven-plugin -->
                    <plugin>
                        <!-- 发布插件：将制品发布到 Maven Central Portal -->
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
