<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2022. Axon Framework
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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">
    <parent>
        <artifactId>axon</artifactId>
        <groupId>org.axonframework</groupId>
        <version>4.6.2</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>axon-modelling-jakarta</artifactId>

    <name>Axon Framework Modelling (Jakarta)</name>
    <description>
        Module containing the necessary components to create domain models, like Aggregates and Sagas.

        This is an automatic clone of the original module transformed to use `jakarta` packages instead of `javax` ones.
    </description>

    <packaging>jar</packaging>

    <!--
        Copies of the dependencies from the original module
    -->

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>axon-messaging-jakarta</artifactId>
            <version>${project.version}</version>
        </dependency>

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

        <dependency>
            <groupId>javax.cache</groupId>
            <artifactId>cache-api</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Optional dependencies -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <optional>true</optional>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Validation -->
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>jakarta.el</groupId>
            <artifactId>jakarta.el-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.el</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>7.0.4.Final</version> <!-- newer version supports jakarta -->
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- JPA support -->
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core-jakarta</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>axon-messaging</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.axonframework</groupId>
                                    <artifactId>axon-modelling</artifactId>
                                    <version>${project.version}</version>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-tests</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.axonframework</groupId>
                                    <artifactId>axon-modelling</artifactId>
                                    <version>${project.version}</version>
                                    <classifier>tests</classifier>
                                    <type>test-jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.transformer</groupId>
                <artifactId>transformer-maven-plugin</artifactId>
                <configuration>
                    <rules>
                        <perClassConstants>
                            <perClassConstant>${basedir}/src/main/resources/perClassConstants.properties</perClassConstant>
                        </perClassConstants>
                    </rules>
                </configuration>
                <executions>
                    <execution>
                        <id>transform</id>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>transform-test</id>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                        <configuration>
                            <transformDirectory>${project.build.testOutputDirectory}</transformDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-banned-dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>javax.validation:*</exclude>
                                        <exclude>javax.el:*</exclude>
                                        <exclude>javax.persistence:*</exclude>
                                        <exclude>javax.inject:*</exclude>

                                        <exclude>jakarta.annotation:*:(,2.0.0)</exclude>
                                        <exclude>jakarta.validation:*:(,3.0.0)</exclude>
                                        <exclude>jakarta.el:*:(,4.0.0)</exclude>
                                        <exclude>jakarta.persistence:*:(,3.0.0)</exclude>
                                        <exclude>jakarta.inject:*:(,2.0.0)</exclude>

                                        <exclude>org.springframework</exclude>
                                    </excludes>
                                    <includes>
                                        <!-- allow any spring dependency with test scope -->
                                        <include>org.springframework:*:*:*:test</include>
                                    </includes>
                                </bannedDependencies>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-assembly-plugin.version}</version>
                <configuration>
                    <descriptorSourceDirectory>
                        ../assembly-jakarta
                    </descriptorSourceDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>build-assembly</id>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
