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

<!--
 Copyright (c) 2014-2018 Red Hat, Inc. and/or its affiliates.

 This program and the accompanying materials are made
 available under the terms of the Eclipse Public License 2.0
 which is available at https://www.eclipse.org/legal/epl-2.0/

 SPDX-License-Identifier: EPL-2.0
-->

<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>org.jberet</groupId>
        <artifactId>jberet-parent</artifactId>
        <version>3.0.0.Final</version>
    </parent>

    <artifactId>jberet-support</artifactId>
    <version>3.0.0.Final</version>

    <properties>
        <modular.jdk.args/>
        <jvmArgs>-Xms512m -Xmx2g ${modular.jdk.args}</jvmArgs>
        <version.org.jberet>3.0.0.Final</version.org.jberet>
        <version.org.mongojack>2.10.0</version.org.mongojack>
        <version.org.apache.kafka>3.8.0</version.org.apache.kafka>
        <version.net.sf.jasperreports>6.21.0</version.net.sf.jasperreports>
        <version.org.apache.activemq.artemis>2.37.0</version.org.apache.activemq.artemis>

        <version.org.beanio>2.1.0</version.org.beanio>
        <version.org.ow2.asm>9.7</version.org.ow2.asm>
        <version.software.amazon.awssdk>2.27.21</version.software.amazon.awssdk>
        <version.jandex>3.2.2</version.jandex>
        <junit-jupiter.version>5.10.3</junit-jupiter.version>
        <version.jakarta.validation.jakarta-validation-api>3.0.2</version.jakarta.validation.jakarta-validation-api>
        <version.org.hibernate.validator>8.0.1.Final</version.org.hibernate.validator>
        <version.persistence-api>3.1.0</version.persistence-api>
    </properties>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.mongojack</groupId>
                <artifactId>mongojack</artifactId>
                <version>${version.org.mongojack}</version>
                <scope>provided</scope>
                <exclusions>
                    <exclusion>
                        <groupId>javax.persistence</groupId>
                        <artifactId>persistence-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- Kafka ItemReader & ItemWriter dependencies -->
            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-clients</artifactId>
                <version>${version.org.apache.kafka}</version>
                <scope>provided</scope>
            </dependency>

            <!-- JasperReports dependencies -->
            <dependency>
                <groupId>net.sf.jasperreports</groupId>
                <artifactId>jasperreports</artifactId>
                <version>${version.net.sf.jasperreports}</version>
                <scope>provided</scope>
            </dependency>

            <!-- Artemis ItemReader & ItemWriter dependencies -->
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>artemis-core-client</artifactId>
                <version>${version.org.apache.activemq.artemis}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>artemis-commons</artifactId>
                <version>${version.org.apache.activemq.artemis}</version>
                <scope>provided</scope>
            </dependency>

            <!-- JmsItemReader & JmsItemWriter test dependencies -->
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>artemis-server</artifactId>
                <version>${version.org.apache.activemq.artemis}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>artemis-jakarta-server</artifactId>
                <version>${version.org.apache.activemq.artemis}</version>
                <scope>test</scope>
            </dependency>

            <!-- BeanIO dependencies -->
            <dependency>
                <groupId>org.beanio</groupId>
                <artifactId>beanio</artifactId>
                <version>${version.org.beanio}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.ow2.asm</groupId>
                <artifactId>asm</artifactId>
                <version>${version.org.ow2.asm}</version>
                <scope>provided</scope>
            </dependency>

            <!-- DynamoDB dependencies -->
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>dynamodb-enhanced</artifactId>
                <version>${version.software.amazon.awssdk}</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mongojack</groupId>
            <artifactId>mongojack</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <version>${version.persistence-api}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml</groupId>
            <artifactId>aalto-xml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.woodstox</groupId>
            <artifactId>stax2-api</artifactId>
        </dependency>

        <dependency>
            <groupId>net.sf.supercsv</groupId>
            <artifactId>super-csv</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-xml</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-csv</artifactId>
        </dependency>

        <!-- beanio dependencies -->
        <dependency>
            <groupId>org.beanio</groupId>
            <artifactId>beanio</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
        </dependency>

        <!-- Excel dependencies -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <!-- override the version from parent pom to work with poi 4.1.2 -->
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
        </dependency>

        <!-- JMS reader & writer dependencies -->
        <dependency>
            <groupId>jakarta.jms</groupId>
            <artifactId>jakarta.jms-api</artifactId>
        </dependency>

        <!-- Kafka ItemReader & ItemWriter dependencies -->
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-clients</artifactId>
        </dependency>

        <!-- Bean Validation dependencies -->
        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <version>${version.jakarta.validation.jakarta-validation-api}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${version.org.hibernate.validator}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.el</groupId>
            <artifactId>jakarta.el-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.el</artifactId>
        </dependency>

        <!-- JasperReports dependencies -->
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
        </dependency>

        <!-- JAX-RS dependencies -->
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
        </dependency>

        <!-- Cassandra dependencies -->
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
        </dependency>

        <!-- DynamoDB dependencies -->
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>dynamodb-enhanced</artifactId>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.jberet</groupId>
            <artifactId>jberet-core</artifactId>
            <version>${version.org.jberet}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jberet</groupId>
            <artifactId>jberet-se</artifactId>
            <version>${version.org.jberet}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-core-impl</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.weld.se</groupId>
            <artifactId>weld-se-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.transaction</groupId>
            <artifactId>jakarta.transaction-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jboss.marshalling</groupId>
            <artifactId>jboss-marshalling</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>artemis-server</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>artemis-jakarta-server</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-joda</artifactId>
            <version>${version.com.fasterxml.jackson}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${version.org.hibernate}</version>
            <scope>test</scope>
            <!--            https://stackoverflow.com/questions/74781315/cdi-with-weld-in-java-se-jakarta-namespace-nosuchmethoderror-->
            <exclusions>
                <exclusion>
                    <groupId>org.jboss</groupId>
                    <artifactId>jandex</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.smallrye</groupId>
            <artifactId>jandex</artifactId>
            <version>${version.jandex}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>${surefire.system.args}</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <configuration>
                            <skipSource>false</skipSource>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jdk17</id>
            <activation>
                <jdk>[17,)</jdk>
            </activation>
            <properties>
                <modular.jdk.args>
                    --add-exports=java.desktop/sun.awt=ALL-UNNAMED
                    --add-opens=java.base/java.io=ALL-UNNAMED
                    --add-opens=java.base/java.lang=ALL-UNNAMED
                    --add-opens=java.base/java.lang.invoke=ALL-UNNAMED
                    --add-opens=java.base/java.lang.reflect=ALL-UNNAMED
                    --add-opens=java.base/java.security=ALL-UNNAMED
                    --add-opens=java.base/java.util=ALL-UNNAMED
                    --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
                    --add-opens=java.management/javax.management=ALL-UNNAMED
                    --add-opens=java.naming/javax.naming=ALL-UNNAMED
                </modular.jdk.args>
            </properties>
        </profile>
        <profile>
            <id>exclude-failed-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>**/Mongo*.java</exclude>
                                <exclude>**/DynamoDb*.java</exclude>
                                <!--                                todo: fix excluded tests-->
                                <exclude>**/JpaItemReaderWriter*.java</exclude>
                                <exclude>**/JmsReaderWriter*.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>allTests</id>
            <activation>
                <property>
                    <name>allTests</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
