<?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.fundoc</groupId>
    <artifactId>quartz-mongodb</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <name>quartz-mongodb</name>
    <description>MongoDB-backed job store for the Quartz scheduler</description>
    <url>https://github.com/fundoc-io/quartz-mongodb</url>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>fundoc-io</name>
            <organization>fundoc-io</organization>
            <organizationUrl>https://github.com/fundoc-io</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/fundoc-io/quartz-mongodb.git</connection>
        <!-- 可选修正：将 developerConnection 改为标准 ssh 形式 -->
        <developerConnection>scm:git:ssh://git@github.com/fundoc-io/quartz-mongodb.git</developerConnection>
        <url>https://github.com/fundoc-io/quartz-mongodb/tree/master</url>
    </scm>

    <!-- 已移除 <distributionManagement>（OSSRH） -->

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Dependency versions -->
        <quartz.version>2.5.0</quartz.version>
        <mongodb.driver.version>5.6.0</mongodb.driver.version>
        <commons.codec.version>1.19.0</commons.codec.version>
        <commons.lang3.version>3.18.0</commons.lang3.version>
        <httpcore.version>4.4.16</httpcore.version>
        <slf4j.version>1.7.36</slf4j.version>
        <clojure.version>1.12.2</clojure.version>
        <joda.time.version>2.14.0</joda.time.version>
        <groovy.version>3.0.25</groovy.version>
        <spock.version>2.4-M6-groovy-3.0</spock.version>
        <cglib.version>3.3.0</cglib.version>
        <objenesis.version>3.4</objenesis.version>
        <embed.mongo.version>4.21.0</embed.mongo.version>

        <!-- Plugin versions -->
        <maven.compiler.plugin.version>3.14.0</maven.compiler.plugin.version>
        <maven.surefire.plugin.version>3.5.4</maven.surefire.plugin.version>
        <gmavenplus.plugin.version>4.2.1</gmavenplus.plugin.version>
        <maven.source.plugin.version>3.3.1</maven.source.plugin.version>
        <maven.javadoc.plugin.version>3.11.3</maven.javadoc.plugin.version>
        <maven.gpg.plugin.version>3.2.8</maven.gpg.plugin.version>
        <exec.maven.plugin.version>3.5.1</exec.maven.plugin.version>
        <spotless.plugin.version>2.46.1</spotless.plugin.version>

        <!-- 新增：Central Publishing Maven Plugin 版本 -->
        <central.publishing.plugin.version>0.8.0</central.publishing.plugin.version>
    </properties>

    <dependencies>
        <!-- Main dependencies -->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>${quartz.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>${mongodb.driver.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>${commons.codec.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons.lang3.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${httpcore.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <!-- Compile-only dependencies -->
        <dependency>
            <groupId>org.clojure</groupId>
            <artifactId>clojure</artifactId>
            <version>${clojure.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>${joda.time.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${groovy.version}</version>
            <type>pom</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>${spock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>${cglib.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.objenesis</groupId>
            <artifactId>objenesis</artifactId>
            <version>${objenesis.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- MongoDB for testing -->
        <dependency>
            <groupId>de.flapdoodle.embed</groupId>
            <artifactId>de.flapdoodle.embed.mongo</artifactId>
            <version>${embed.mongo.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Compiler plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>

            <!-- GMavenPlus plugin for Groovy/Spock tests -->
            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>${gmavenplus.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compileTests</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Surefire plugin for running tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                        <include>**/*Test.groovy</include>
                        <include>**/*Spec.groovy</include>
                    </includes>
                    <useFile>false</useFile>
                    <skipAfterFailureCount>0</skipAfterFailureCount>
                </configuration>
            </plugin>

            <!-- Source plugin -->
            <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</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Javadoc plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.plugin.version}</version>
                <configuration>
                    <doclint>none</doclint>
                    <quiet>true</quiet>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Spotless plugin -->
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.plugin.version}</version>
                <configuration>
                    <java>
                        <includes>
                            <include>src/main/java/**/*.java</include>
                            <include>src/test/java/**/*.java</include>
                        </includes>
                        <eclipse>
                            <file>${project.basedir}/style/eclipse-java-formatter.xml</file>
                        </eclipse>
                        <importOrder>
                            <file>${project.basedir}/style/eclipse.importorder</file>
                        </importOrder>
                        <removeUnusedImports/>
                    </java>
                    <groovy>
                        <includes>
                            <include>src/**/*.groovy</include>
                        </includes>
                        <greclipse>
                            <file>${project.basedir}/style/greclipse.properties</file>
                        </greclipse>
                    </groovy>
                    <pom>
                        <sortPom>
                            <nrOfIndentSpace>4</nrOfIndentSpace>
                        </sortPom>
                    </pom>
                </configuration>
                <executions>
                    <execution>
                        <id>spotless-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                    <execution>
                        <id>spotless-apply</id>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                        <phase>prepare-package</phase>
                    </execution>
                </executions>
            </plugin>

            <!-- Exec plugin (dev only, unchanged) -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${exec.maven.plugin.version}</version>
                <configuration>
                    <mainClass>de.flapdoodle.embed.mongo.MongodStarter</mainClass>
                </configuration>
            </plugin>

            <!-- ★ New: Central Publishing Maven Plugin -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${central.publishing.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <!-- 与 settings.xml 中的 <server><id>central</id> 配置对应 -->
                    <publishingServerId>central</publishingServerId>

                    <!-- CI 常用：验证通过后自动发布；如需手动发布可移除此项 -->
                    <autoPublish>true</autoPublish>

                    <!-- 可选：阻塞直到“已发布”（需 autoPublish=true） -->
                    <waitUntil>published</waitUntil>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Release profile：仅保留签名；已移除 nexus-staging 插件 -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>verify</phase>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Embedded Mongo tests -->
        <profile>
            <id>embedded-mongo</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <embedMongo>true</embedMongo>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
