<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Copyright (c) 2010-2026. AxonIQ B.V.
  ~
  ~ Licensed under the AXONIQ TERMS OF SERVICE,
  ~ Version 29 April 2026 (the "License");
  ~
  ~ The software is available for evaluation use without registration.
  ~ Continued use beyond the evaluation period requires registration
  ~ and a commercial license. See the License for the specific language
  ~ governing permissions and limitations under the License.
  ~ You may not use this file except in compliance with the License.
  ~
  ~ You may obtain a copy of the License at:
  ~  https://www.axoniq.io/legal/terms-of-service
  ~
  ~ For licensing information and to register, visit:
  ~  https://www.axoniq.io/pricing
  -->

<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>io.axoniq.framework</groupId>
        <artifactId>axoniq-framework-parent</artifactId>
        <version>5.4.0</version>
        <relativePath>../../build/parent/pom.xml</relativePath>
    </parent>

    <artifactId>axoniq-springcloud</artifactId>

    <name>Axoniq Framework - Spring Cloud</name>
    <description>
        Connector module for Axoniq Framework distributing messages across the nodes reported by a Spring Cloud
        Discovery client, without requiring Axon Server.
    </description>

    <properties>
        <maven-enforcer.allow-spring-dependencies>true</maven-enforcer.allow-spring-dependencies>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.axoniq.license</groupId>
            <artifactId>entitlement-manager</artifactId>
        </dependency>
        <dependency>
            <groupId>io.axoniq.framework</groupId>
            <artifactId>axoniq-distributed-messaging</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-messaging</artifactId>
        </dependency>

        <!--
            Optional dependencies on Spring, matching axon-server-connector. The Spring Cloud Spring Boot starter
            brings the web stack, and the discovery implementation (Eureka, Consul, Kubernetes) stays the
            application's choice, so neither is propagated transitively from here.
        -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-commons</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- Test-only: provides the servlet API the Spring MVC test support compiles against. -->
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- The RestClient needs a JSON message converter to read and write the wire format. Applications get one
             from spring-boot-starter-web; the tests bring their own. -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <!-- Optional, like the Spring dependencies: members exchange commands and their replies as JSON, which
                 this reads and writes directly rather than through content negotiation. Any Spring Boot web
                 application already has it. -->
            <optional>true</optional>
        </dependency>
        <dependency>
            <!-- The query wire records use Jackson annotations to remain readable by members on earlier versions. -->
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-messaging</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-common</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>io.axoniq.framework.springcloud</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
