<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2026. Axoniq B.V.
  ~
  ~ Licensed under the Axoniq Terms of Service (the "Terms"). You may not
  ~ use this file except in compliance with the Terms, available at
  ~ https://www.axoniq.io/legal/terms-of-service
  -->

<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.1</version>
        <relativePath>../../build/parent/pom.xml</relativePath>
    </parent>

    <artifactId>axoniq-legacy</artifactId>

    <name>Axoniq Framework - Legacy</name>
    <description>
        This module contains legacy solutions of Axon Framework 4, such as sagas and deadlines. Use this dependency to
        ease the migration period for projects that cannot move off these APIs in one go.
    </description>

    <packaging>jar</packaging>

    <properties>
        <!-- Loaded in an isolated class loader by Af4SerializerCompatibilityTest and the deadline compatibility tests.
             Keeping the AF4 artifacts out of the dependency graph prevents their org.axonframework classes from
             colliding with the reactor's AF5 classes. -->
        <axon4.serializer.version>4.13.2</axon4.serializer.version>
        <!-- The deadline managers' scheduler libraries. Only this module uses them, so it manages their versions. Axon
             Framework 4 nodes share the libraries' stores during a rolling upgrade, so keep the major versions equal
             to Axon Framework 4.13's. -->
        <quartz.version>2.5.2</quartz.version>
        <jobrunr.version>8.8.2</jobrunr.version>
        <db-scheduler.version>16.12.0</db-scheduler.version>
    </properties>

    <dependencies>
        <!-- Axoniq Entitlement -->
        <dependency>
            <groupId>io.axoniq.license</groupId>
            <artifactId>entitlement-manager</artifactId>
        </dependency>

        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-messaging</artifactId>
            <version>${axon-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-modelling</artifactId>
            <version>${axon-framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-conversion</artifactId>
            <version>${axon-framework.version}</version>
        </dependency>
        <!-- StoredDeadlineConverter: the JSON strings of String and byte[] deadline payloads, and metadata maps.
             Jackson's streaming core only, which has no dependencies that could clash with an application's
             Jackson 2. -->
        <dependency>
            <groupId>tools.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>

        <!-- XStreamConverter: draining Axon Framework 4 XStream-serialized sagas, deadlines and scheduled events -->
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.4.21</version>
            <optional>true</optional>
        </dependency>

        <!-- JPA saga store -->
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Mongo saga store -->
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Caching saga store -->
        <dependency>
            <groupId>javax.cache</groupId>
            <artifactId>cache-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Deadline manager backends -->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>${quartz.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.jobrunr</groupId>
            <artifactId>jobrunr</artifactId>
            <version>${jobrunr.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.github.kagkarlsson</groupId>
            <artifactId>db-scheduler</artifactId>
            <version>${db-scheduler.version}</version>
            <optional>true</optional>
        </dependency>

        <!-- Spring integration for the ported Sagas. Optional: a migrating Spring application already provides
             these on its classpath, while a non-Spring application keeps them off the graph entirely. -->
        <!-- The Spring Saga wiring builds on axon-spring's EventProcessorDefinition processor-configuration SPI, so
             axoniq-legacy compiles against axon-spring. Kept optional: only a Spring application (which already has
             axon-spring) uses these classes. -->
        <dependency>
            <groupId>org.axonframework.extensions.spring</groupId>
            <artifactId>axon-spring</artifactId>
            <version>${axon-framework.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- For ConditionalOnMissingQualifiedBean, so the db-scheduler task backs off on a qualified bean as in Axon
             Framework 4. Optional: every Spring Boot application has it through axoniq-spring-boot-autoconfigure. -->
        <dependency>
            <groupId>org.axonframework.extensions.spring</groupId>
            <artifactId>axon-spring-boot-autoconfigure</artifactId>
            <version>${axon-framework.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-conversion</artifactId>
            <version>${axon-framework.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.axonframework</groupId>
            <artifactId>axon-messaging</artifactId>
            <version>${axon-framework.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- Exercises db-scheduler's Gson-based serializer with the deadline details. -->
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate.orm</groupId>
            <artifactId>hibernate-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>${ojdbc.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers-oracle-xe</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers-mongodb</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers-junit-jupiter</artifactId>
            <version>${testcontainers.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- Spring (Boot) testing -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.axonframework.extensions.spring</groupId>
            <artifactId>axon-spring-boot-starter</artifactId>
            <version>${axon-framework.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-to-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-af4-serializer</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <skip>${skipTests}</skip>
                            <outputDirectory>${project.build.directory}/af4-serializer</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.axonframework</groupId>
                                    <artifactId>axon-messaging</artifactId>
                                    <version>${axon4.serializer.version}</version>
                                    <destFileName>axon-messaging-af4.jar</destFileName>
                                </artifactItem>
                                <!-- The Axon Framework 4 scope descriptors, for the deadline compatibility tests. -->
                                <artifactItem>
                                    <groupId>org.axonframework</groupId>
                                    <artifactId>axon-modelling</artifactId>
                                    <version>${axon4.serializer.version}</version>
                                    <destFileName>axon-modelling-af4.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>org.axonframework.legacy</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
