<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2023. 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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.axonframework.extensions.kafka</groupId>
    <artifactId>axon-kafka-parent</artifactId>
    <version>4.12.0</version>

    <packaging>pom</packaging>

    <modules>
        <module>kafka</module>
        <module>kafka-spring-boot-autoconfigure</module>
        <module>kafka-spring-boot-starter</module>
        <!-- Example module is inside the profile and can be switched off -->
    </modules>

    <name>Axon Framework - Kafka Extension</name>
    <description>An Axon Framework extension enabling Kafka integration</description>

    <inceptionYear>2010</inceptionYear>
    <url>https://axoniq.io/</url>
    <licenses>
        <license>
            <name>Apache 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>
    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/AxonFramework/extension-kafka/issues</url>
    </issueManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <sonar.coverage.jacoco.xmlReportPaths>
            ${project.basedir}/coverage-report/target/site/jacoco-aggregate/jacoco.xml,
            ${project.basedir}/../coverage-report/target/site/jacoco-aggregate/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>
        <!-- Main -->
        <axon.version>4.12.0</axon.version>
        <kafka.version>3.9.0</kafka.version>
        <!-- Spring -->
        <spring.boot.version>2.7.18</spring.boot.version>
        <!-- Logging -->
        <slf4j.version>2.0.17</slf4j.version>
        <log4j.version>2.25.1</log4j.version>
        <!-- Testing -->
        <commons-io.version>2.20.0</commons-io.version>
        <jackson.version>2.19.2</jackson.version>
        <javax.inject.version>1</javax.inject.version>
        <jaxb-api.version>2.3.1</jaxb-api.version>
        <junit.jupiter.version>5.13.3</junit.jupiter.version>
        <mockito.version>4.11.0</mockito.version>
        <awaitility.version>4.3.0</awaitility.version>
        <!-- Plugins -->
        <central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>
        <jacoco-maven.version>0.8.13</jacoco-maven.version>
        <maven-assembly.version>3.7.1</maven-assembly.version>
        <maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
        <maven-compiler.version>3.14.0</maven-compiler.version>
        <maven-enforcer.version>3.6.1</maven-enforcer.version>
        <maven-failsafe.version>3.5.3</maven-failsafe.version>
        <maven-gpg.version>3.2.8</maven-gpg.version>
        <maven-install-plugin.version>3.1.4</maven-install-plugin.version>
        <maven-jar.version>3.4.2</maven-jar.version>
        <maven-javadoc.version>3.11.2</maven-javadoc.version>
        <maven-release.version>3.1.1</maven-release.version>
        <maven-resources.version>3.3.1</maven-resources.version>
        <maven-source.version>3.3.1</maven-source.version>
        <maven-surefire.version>2.22.2</maven-surefire.version>
        <!-- Test matcher -->
        <pattern.class.test>**/*Test.java</pattern.class.test>
        <pattern.class.integration-test>**/*IntegrationTest.java</pattern.class.integration-test>
    </properties>

    <dependencies>
        <!-- Testing -->
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>${awaitility.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>${javax.inject.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- Not part of Java 9 by default. Adding it as a dependency makes it compatible with Java 8 -->
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>${jaxb-api.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <!-- Spring -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-configuration-processor</artifactId>
                <version>${spring.boot.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
                <version>${spring.boot.version}</version>
            </dependency>
            <!-- Testing -->
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.jupiter.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-junit-jupiter</artifactId>
                <version>${mockito.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <defaultGoal>clean package</defaultGoal>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven-clean-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven-install-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- compile -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler.version}</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <!-- test -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven.version}</version>
                <executions>
                    <execution>
                        <id>prepare-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <propertyName>surefireArgLine</propertyName>
                            <destFile>${project.build.directory}/jacoco-ut.exec</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${project.build.directory}/jacoco-ut.exec</dataFile>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                            <excludes>
                                <exclude>${pattern.class.integration-test}</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!--suppress MavenModelInspection -->
                    <argLine>-Djava.awt.headless=true ${surefireArgLine}</argLine>
                    <systemPropertyVariables>
                        <slf4j.version>${slf4j.version}</slf4j.version>
                        <log4j.version>${log4j.version}</log4j.version>
                    </systemPropertyVariables>
                    <includes>
                        <include>${pattern.class.test}</include>
                    </includes>
                    <excludes>
                        <exclude>${pattern.class.integration-test}</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- package -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-assembly.version}</version>
                <configuration>
                    <descriptorSourceDirectory>assembly</descriptorSourceDirectory>
                    <archiverConfig>
                        <duplicateBehavior>skip</duplicateBehavior>
                    </archiverConfig>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <!-- deploy -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${central-publishing-maven-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <excludeArtifacts>
                        kafka-axon-example
                    </excludeArtifacts>
                    <publishingServerId>central</publishingServerId>
                </configuration>
            </plugin>
            <plugin>
                <!-- just to make sure deployed artifacts are always built (and tested) using JDK 8+ -->
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer.version}</version>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>1.8</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>3.5</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven-release.version}</version>
                <configuration>
                    <!-- prepare goal configuration -->
                    <mavenExecutorId>forked-path</mavenExecutorId>
                    <pushChanges>false</pushChanges>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <!-- perform goal configuration -->
                    <mavenExecutorId>forked-path</mavenExecutorId>
                    <localCheckout>true</localCheckout>
                    <releaseProfiles>javadoc,sources,sign</releaseProfiles>
                    <tagNameFormat>axon-kafka-@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources.version}</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>coverage-aggregate</id>
            <build>
                <defaultGoal>verify</defaultGoal>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven-surefire.version}</version>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <modules>
                <module>coverage-report</module>
            </modules>
        </profile>

        <profile>
            <id>examples</id>
            <activation>
                <property>
                    <name>!skipExamples</name>
                </property>
            </activation>
            <modules>
                <module>kafka-axon-example</module>
            </modules>
        </profile>

        <profile>
            <id>integration-test</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <defaultGoal>verify</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco-maven.version}</version>
                        <executions>
                            <execution>
                                <id>prepare-integration-test</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <propertyName>failsafeArgLine</propertyName>
                                    <destFile>${project.build.directory}/jacoco-it.exec</destFile>
                                </configuration>
                            </execution>
                            <execution>
                                <id>report-integration-test</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <dataFile>${project.build.directory}/jacoco-it.exec</dataFile>
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                                    <excludes>
                                        <exclude>${pattern.class.test}</exclude>
                                    </excludes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven-surefire.version}</version>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${maven-failsafe.version}</version>
                        <executions>
                            <execution>
                                <id>run-integration-tests</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <!--suppress MavenModelInspection -->
                                    <argLine>-Djava.awt.headless=true ${failsafeArgLine}</argLine>
                                    <includes>
                                        <include>${pattern.class.integration-test}</include>
                                    </includes>
                                </configuration>
                            </execution>
                            <execution>
                                <id>verify</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>java17-modules</id>
            <activation>
                <jdk>[17,)</jdk>
            </activation>
            <modules>
                <module>kafka-spring-boot-3-integrationtests</module>
            </modules>
        </profile>

        <profile>
            <id>sources</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>javadoc</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <doclint>none</doclint>
                            <detectJavaApiLink>false</detectJavaApiLink>
                            <!-- These parameters are in preparation for resolution of this issue: -->
                            <!-- https://bugs.openjdk.java.net/browse/JDK-8068562 -->
                            <tags>
                                <tag>
                                    <name>apiNote</name>
                                    <placement>a</placement>
                                    <head>API Note:</head>
                                </tag>
                                <tag>
                                    <name>implSpec</name>
                                    <placement>a</placement>
                                    <head>Implementation Requirements:</head>
                                </tag>
                                <tag>
                                    <name>implNote</name>
                                    <placement>a</placement>
                                    <head>Implementation Note:</head>
                                </tag>
                            </tags>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <!--suppress MavenModelInspection -->
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <scm>
        <connection>scm:git:git://github.com/AxonFramework/extension-kafka.git</connection>
        <developerConnection>scm:git:git@github.com:AxonFramework/extension-kafka.git</developerConnection>
        <url>https://github.com/AxonFramework/extension-kafka</url>
        <tag>axon-kafka-4.12.0</tag>
    </scm>

    <developers>
        <developer>
            <name>Allard Buijze</name>
            <email>allard.buijze@axoniq.io</email>
            <organization>AxonIQ</organization>
            <organizationUrl>https://axoniq.io</organizationUrl>
            <roles>
                <role>Project Owner</role>
            </roles>
        </developer>
        <developer>
            <name>Steven van Beelen</name>
            <email>steven.vanbeelen@axoniq.io</email>
            <organization>AxonIQ</organization>
            <organizationUrl>https://axoniq.io</organizationUrl>
            <roles>
                <role>Lead Developer</role>
            </roles>
        </developer>
        <developer>
            <name>Mitchell Herrijgers</name>
            <email>mitchell.herrijgers@axoniq.io</email>
            <organization>AxonIQ</organization>
            <organizationUrl>https://axoniq.io</organizationUrl>
            <roles>
                <role>Developer</role>
            </roles>
        </developer>
        <developer>
            <name>Mateusz Nowak</name>
            <email>mateusz.nowak@axoniq.io</email>
            <organization>AxonIQ</organization>
            <organizationUrl>https://axoniq.io</organizationUrl>
            <roles>
                <role>Developer</role>
            </roles>
        </developer>
        <developer>
            <name>Simon Zambrovski</name>
            <email>simon.zambrovskin@holisticon.de</email>
            <organization>Holisticon AG</organization>
            <organizationUrl>https://holisticon.de</organizationUrl>
            <roles>
                <role>Developer</role>
            </roles>
        </developer>
    </developers>
</project>
