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

    <!-- ================================================================ -->
    <!--  Maven Central Coordinates                                        -->
    <!-- ================================================================ -->
    <groupId>io.github.miea04</groupId>
    <artifactId>foundation-api</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <!-- ================================================================ -->
    <!--  Project Metadata                                                 -->
    <!-- ================================================================ -->
    <name>Foundation API</name>
    <description>
        Foundation API 是 Minecraft 模组 foundation-core 的前置核心 API 模块，
        提供轻量、显式、需要手动注册的服务容器能力，
        以及基础的服务发现与 Capability 注册机制。
    </description>
    <url>https://github.com/MieA04/foundation-api</url>

    <inceptionYear>2026</inceptionYear>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:MieA04/foundation-api.git</connection>
        <developerConnection>scm:git:git@github.com:MieA04/foundation-api.git</developerConnection>
        <url>https://github.com/MieA04/foundation-api</url>
        <tag>master</tag>
    </scm>

    <developers>
        <developer>
            <name>MieA04</name>
            <email>adfore370@gmail.com</email>
            <url>https://github.com/MieA04</url>
            <organization>MieA04</organization>
            <organizationUrl>https://github.com/MieA04</organizationUrl>
            <roles>
                <role>owner</role>
                <role>developer</role>
            </roles>
        </developer>
    </developers>

    <!-- 不改变 Java 源代码包名，仅 groupId 采用已验证的 Maven Central namespace -->
    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <junit.jupiter.version>5.10.2</junit.jupiter.version>

        <!-- 插件版本 -->
        <maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
        <maven-source-plugin.version>3.3.0</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
        <maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
        <central-publishing-maven-plugin.version>0.5.0</central-publishing-maven-plugin.version>
    </properties>

    <!-- ================================================================ -->
    <!--  Dependencies                                                     -->
    <!-- ================================================================ -->
    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!-- ================================================================ -->
    <!--  Build Plugins                                                    -->
    <!-- ================================================================ -->
    <build>
        <plugins>
            <!-- Java Compiler -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>21</source>
                    <target>21</target>
                    <parameters>true</parameters>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>

            <!-- Test Runner -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
            </plugin>

            <!-- Sources JAR（Maven Central 必需） -->
            <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-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Javadoc JAR（Maven Central 必需） -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <doclint>none</doclint>
                    <encoding>UTF-8</encoding>
                    <charset>UTF-8</charset>
                    <source>21</source>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- GPG 签名（Maven Central 必需） -->
            <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>
                        <configuration>
                            <!-- 如果 GPG 密钥需要 passphrase，避免交互式弹窗 -->
                            <!-- gpgArguments 可设置 batch, passphrase 等参数 -->
                            <gpgArguments>
                                <arg>--no-tty</arg>
                            </gpgArguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- ================================================================ -->
    <!--  Distribution Management                                          -->
    <!--  发布到 Maven Central（Central Portal）                            -->
    <!-- ================================================================ -->
    <distributionManagement>
        <snapshotRepository>
            <id>central</id>
            <url>https://central.sonatype.com/api/v1/publisher/upload</url>
        </snapshotRepository>
        <repository>
            <id>central</id>
            <url>https://central.sonatype.com/api/v1/publisher/upload</url>
        </repository>
    </distributionManagement>

    <!-- Sonatype Central Publishing Maven Plugin -->
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
