<?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>com.dnastack</groupId>
    <artifactId>dnastack-oauth-client-factory-spring-starter</artifactId>
    <version>4.0.1</version> <!-- All modules match this version. Keep it at 1.0.0-SNAPSHOT. The CI build updates it globally at build time to the value of `git describe`. -->
    <name>dnastack-oauth-client-factory-spring-starter</name>
    <description>This is a Spring Boot Starter package for the dnastack-oauth-client-factory.</description>
    <url>https://github.com/DNAstack/java-open-source-libraries</url>

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

    <developers>
        <developer>
            <name>DNAstack</name>
            <email>info@dnastack.com</email>
            <organization>DNAstack</organization>
            <organizationUrl>https://dnastack.com</organizationUrl>
        </developer>
    </developers>

    <properties>
        <java.version>21</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.plugin.version>3.15.0</maven.compiler.plugin.version>
        <maven.surefile.plugin.version>2.22.2</maven.surefile.plugin.version>
        <maven.source-plugin.version>3.4.0</maven.source-plugin.version>
        <maven.javadoc-plugin.version>3.12.0</maven.javadoc-plugin.version>
        <sign-maven-plugin.version>1.1.0</sign-maven-plugin.version>
        <!-- DNAstack Libs -->
        <!-- Sibling module in the aggregator; bound to ${project.version} so it tracks the aggregator version. -->
        <dnastack.oauth-client-factory.version>${project.version}</dnastack.oauth-client-factory.version>
        <!-- Other -->
        <spring-cloud.version>2025.0.2</spring-cloud.version>
        <!-- Override Spring Cloud 2025.0.2's pin (3.5.13) to pull in the fix for CVE-2026-40973
             (predictable temp directory in Spring Boot). -->
        <spring-boot.version>3.5.14</spring-boot.version>
        <lombok.version>1.18.44</lombok.version>
        <jackson.version>2.16.1</jackson.version>
        <slf4j.version>2.0.10</slf4j.version>
        <junit.version>5.14.3</junit.version>
        <mockito.version>5.8.0</mockito.version>
        <hamcrest.version>2.2</hamcrest.version>
        <feign.version>13.1</feign.version>
        <feign-form.version>3.8.0</feign-form.version>
        <okhttp3.version>4.12.0</okhttp3.version>
        <micrometer-tracing.version>1.6.5</micrometer-tracing.version>
        <opentelemetry.version>1.61.0</opentelemetry.version>

    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Imported before spring-cloud so its pins (notably spring-boot 3.5.14) win. -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-parent</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.micrometer</groupId>
                <artifactId>micrometer-tracing-bom</artifactId>
                <version>${micrometer-tracing.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.opentelemetry</groupId>
                <artifactId>opentelemetry-bom</artifactId>
                <version>${opentelemetry.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- DNAStack -->
        <dependency>
            <groupId>com.dnastack</groupId>
            <artifactId>dnastack-oauth-client-factory</artifactId>
            <version>${dnastack.oauth-client-factory.version}</version>
        </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <!-- Development Tools -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Feign -->
        <dependency>
            <groupId>io.github.openfeign</groupId>
            <artifactId>feign-core</artifactId>
            <version>${feign.version}</version>
        </dependency>
        <dependency>
            <groupId>io.github.openfeign</groupId>
            <artifactId>feign-okhttp</artifactId>
            <version>${feign.version}</version>
        </dependency>
        <dependency>
            <groupId>io.github.openfeign</groupId>
            <artifactId>feign-slf4j</artifactId>
            <version>${feign.version}</version>
        </dependency>
        <dependency>
            <groupId>io.github.openfeign</groupId>
            <artifactId>feign-jackson</artifactId>
            <version>${feign.version}</version>
        </dependency>
        <dependency>
            <groupId>io.github.openfeign.form</groupId>
            <artifactId>feign-form</artifactId>
            <version>${feign-form.version}</version>
        </dependency>
        <!-- Test -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Provides OpenTelemetryAutoConfiguration / OpenTelemetryTracingAutoConfiguration for the trace-propagation test -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-autoconfigure</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <version>${okhttp3.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-tracing-bridge-otel</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-sdk</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <!-- Annotation processing is needed by Lombok -->
                    <compilerArgs>
                        <arg>-proc:full</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefile.plugin.version}</version>
            </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>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc-plugin.version}</version>
                <configuration>
                    <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
                    <!-- Suppress "no comment" floods; keep real checks like malformed @param/@return tags. -->
                    <doclint>all,-missing</doclint>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- Signs artifacts when SIGN_KEY/SIGN_KEY_PASS env vars are set; skips otherwise so
                     local builds work without a key. CI must set those vars to produce signed jars. -->
                <groupId>org.simplify4u.plugins</groupId>
                <artifactId>sign-maven-plugin</artifactId>
                <version>${sign-maven-plugin.version}</version>
                <configuration>
                    <skipNoKey>true</skipNoKey>
                </configuration>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Activate to deploy this module to DNAstack's private GitHub Packages Maven repo. -->
        <profile>
            <id>dnastack-gh-packages</id>
            <distributionManagement>
                <repository>
                    <id>github</id>
                    <name>GitHub DNAstack Apache Maven Packages</name>
                    <url>https://maven.pkg.github.com/DNAstack/dnastack-packages</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>

    <scm>
        <connection>scm:git:https://github.com/DNAstack/java-open-source-libraries.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/DNAstack/java-open-source-libraries.git</developerConnection>
        <url>https://github.com/DNAstack/java-open-source-libraries/tree/main</url>
    </scm>
</project>
