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

    <parent>
        <groupId>cn.qaiu</groupId>
        <artifactId>netdisk-fast-download</artifactId>
        <version>${revision}</version>
    </parent>

    <groupId>cn.qaiu</groupId>
    <artifactId>parser</artifactId>
    <version>10.1.13</version>
    <packaging>jar</packaging>

    <name>cn.qaiu:parser</name>
    <description>NFD parser module</description>
    <url>https://qaiu.top</url>

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

    <developers>
        <developer>
            <name>qaiu</name>
            <email>qaiu00@gmail.com</email>
            <organization>https://qaiu.top</organization>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/qaiu/netdisk-fast-download.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:qaiu/netdisk-fast-download.git</developerConnection>
        <url>https://github.com/qaiu/netdisk-fast-download</url>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>sonatype</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <revision>0.1.8</revision>
        <java.version>17</java.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Versions -->
        <vertx.version>4.5.21</vertx.version>
        <org.reflections.version>0.10.2</org.reflections.version>
        <lombok.version>1.18.38</lombok.version>
        <slf4j.version>2.0.5</slf4j.version>
        <commons-lang3.version>3.18.0</commons-lang3.version>
        <jackson.version>2.14.2</jackson.version>
        <logback.version>1.5.19</logback.version>
        <junit.version>4.13.2</junit.version>
    </properties>

    <dependencies>
        <!-- Logging -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <!-- Vert.x Web Client -->
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-web-client</artifactId>
            <version>${vertx.version}</version>
        </dependency>

        <!-- Common Utils -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>

        <!-- Script Engine -->
        <dependency>
            <groupId>org.openjdk.nashorn</groupId>
            <artifactId>nashorn-core</artifactId>
            <version>15.4</version>
            <scope>compile</scope>
        </dependency>

        <!-- Compression (Brotli) -->
        <dependency>
            <groupId>org.brotli</groupId>
            <artifactId>dec</artifactId>
            <version>0.1.2</version>
        </dependency>

        <!-- Unit Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <!-- 编译 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>

            <!-- 打包源码 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Javadoc (空包防验证失败) -->
            <!-- Javadoc（兼容新版配置，无需源码中存在注释） -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.7.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <!-- 忽略 Javadoc 错误 -->
                            <failOnError>false</failOnError>
                            <!-- 禁用 doclint（新版参数名改为 additionalOptions） -->
                            <additionalOptions>-Xdoclint:none</additionalOptions>
                            <!-- 如果项目源码中几乎没有 Javadoc，可设 true -->
                            <quiet>true</quiet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- GPG 签名（新版插件推荐写法） -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>3.2.7</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <configuration>
                            <!-- 避免在 CI 环境出现 TTY 错误 -->
                            <gpgArguments>
                                <arg>--batch</arg>
                                <arg>--yes</arg>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Sonatype Central 自动发布 -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.6.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>sonatype</publishingServerId>
                    <autoPublish>true</autoPublish>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>1.7.3</version>
                <executions>
                    <!-- 1 在 verify 阶段生成 flattened POM -->
                    <execution>
                        <id>flatten</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                        <configuration>
                            <!-- 不改原pom -->
                            <updatePomFile>false</updatePomFile>
                            <!-- 输出到 target/flattened-pom.xml -->
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <!-- 去掉 parent、属性引用等 -->
                            <flattenMode>ossrh</flattenMode>
                        </configuration>
                    </execution>

                    <!-- 2 发布后恢复 -->
                    <execution>
                        <id>flatten.clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <!-- 指定 deploy 使用 flattened POM -->
                    <pomFile>${project.build.directory}/.flattened-pom.xml</pomFile>
                </configuration>
            </plugin>

        </plugins>

    </build>
</project>
