<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mymarz</groupId>
    <artifactId>marz-spring-boot-starter</artifactId>
    <version>0.1.2</version>
    <packaging>jar</packaging>

    <name>MARZ Spring Boot Starter</name>
    <description>Runtime configuration hot-swap for Spring Boot — change feature flags, toggles, and config values without restart</description>
    <url>https://github.com/NAMAN143-code/mymarz</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>naman</id>
            <name>Naman Sharma</name>
            <email>naman143sharma@gmail.com</email>
            <organization>MARZ</organization>
            <organizationUrl>https://github.com/NAMAN143-code/mymarz</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/NAMAN143-code/mymarz.git</connection>
        <developerConnection>scm:git:ssh://github.com:NAMAN143-code/mymarz.git</developerConnection>
        <url>https://github.com/NAMAN143-code/mymarz</url>
    </scm>

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

        <!-- Spring Boot -->
        <spring-boot.version>3.3.5</spring-boot.version>

        <!-- Testing -->
        <junit-jupiter.version>5.10.3</junit-jupiter.version>
        <mockito.version>5.12.0</mockito.version>
        <assertj.version>3.27.7</assertj.version>
        <awaitility.version>4.2.1</awaitility.version>

        <!-- Parsing -->
        <snakeyaml.version>2.2</snakeyaml.version>
        <jackson.version>2.17.2</jackson.version>

        <!-- Metrics -->
        <micrometer.version>1.13.4</micrometer.version>

        <!-- Plugins -->
        <maven-surefire.version>3.3.1</maven-surefire.version>
        <maven-failsafe.version>3.3.1</maven-failsafe.version>
        <jacoco.version>0.8.13</jacoco.version>
        <maven-source.version>3.3.1</maven-source.version>
        <maven-javadoc.version>3.8.0</maven-javadoc.version>
        <maven-gpg.version>3.2.5</maven-gpg.version>
        <central-publishing.version>0.10.0</central-publishing.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Spring Boot Core (provided — users bring their own) -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Health Indicator (optional — only activates when actuator is on classpath) -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Config Parsing -->
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>${snakeyaml.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- Metrics (optional) -->
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-core</artifactId>
            <version>${micrometer.version}</version>
            <optional>true</optional>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>${awaitility.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>${java.version}</source>
                    <target>${java.version}</target>
                    <parameters>true</parameters>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire.version}</version>
                <configuration>
                    <!--
                      @{argLine} carries the JaCoCo agent injected by prepare-agent.
                      net.bytebuddy.experimental lets Mockito's inline mock maker run
                      on JVMs newer than its bundled Byte Buddy officially supports
                      (e.g. building on JDK 24 while targeting Java 17).
                    -->
                    <argLine>@{argLine} -Dnet.bytebuddy.experimental=true</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven-failsafe.version}</version>
                <configuration>
                    <argLine>@{argLine} -Dnet.bytebuddy.experimental=true</argLine>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <goals><goal>prepare-agent</goal></goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals><goal>report</goal></goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source.version}</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-javadoc-plugin</artifactId>
                        <version>${maven-javadoc.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals><goal>jar</goal></goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals><goal>sign</goal></goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!--
                      Publishes to Maven Central via the Sonatype Central Portal.
                      Replaces the legacy nexus-staging-maven-plugin + OSSRH, which
                      reached end-of-life on 2025-06-30. No distributionManagement is
                      needed; this plugin uploads directly to the Portal API.
                      The 'central' serverId must match a <server> in settings.xml
                      holding a Central Portal user token.
                    -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <!--
                              autoPublish=false: the deploy uploads and validates the
                              bundle, then waits for a manual "Publish" click in the
                              Central Portal UI. This is a safety gate for the first
                              release — once the 0.1.0 publish is confirmed good, flip
                              this back to true so later tags publish automatically.
                            -->
                            <autoPublish>false</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
