<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" child.project.url.inherit.append.path="false" 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>com.infobip.kafkistry</groupId>
    <artifactId>kafkistry-parent</artifactId>
    <packaging>pom</packaging>
    <version>0.10.0</version>

    <name>Kafkistry</name>
    <description>
        Registry service for Apache Kafka which keeps track of topics, consumer-groups, acls, quotas and their configuration/state/metadata across multiple kafka-clusters.
        It allows performing administrative operations such as inspecting/creating/deleting/re-configuring topics/consumer-groups.
        It also provides various analytical tools such as: SQL querying metadata; viewing topic records; analyzing json record structures; re-balancing cluster tools; etc.
    </description>
    <url>https://github.com/infobip/kafkistry</url>
    <organization>
        <name>Infobip, Ltd.</name>
        <url>https://infobip.com</url>
    </organization>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Antonio Tomac</name>
            <email>antonio.tomac@infobip.com</email>
            <organization>Infobip, Ltd.</organization>
            <organizationUrl>https://infobip.com</organizationUrl>
        </developer>
    </developers>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>3.4.4</version>
        <relativePath />
    </parent>

    <modules>
        <module>kafkistry-model</module>
        <module>kafkistry-common</module>
        <module>kafkistry-kafka-connector</module>
        <module>kafkistry-repository</module>
        <module>kafkistry-consume</module>
        <module>kafkistry-produce</module>
        <module>kafkistry-record-structure</module>
        <module>kafkistry-state-scraping</module>
        <module>kafkistry-events</module>
        <module>kafkistry-security</module>
        <module>kafkistry-service-logic</module>
        <module>kafkistry-sql</module>
        <module>kafkistry-prometheus-metrics-export</module>
        <module>kafkistry-web-api</module>
        <module>kafkistry-mcp</module>
        <module>kafkistry-autopilot</module>
        <module>kafkistry-web</module>
        <module>kafkistry-auditing</module>
        <module>kafkistry-app</module>
    </modules>

    <properties>
        <!-- PROJECT -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <jdk.version>21</jdk.version>
        <java.version>21</java.version>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <kotlin.version>2.1.20</kotlin.version>
        <kotlin.jvm.target>21</kotlin.jvm.target>
        <kotlin.compiler.incremental>false</kotlin.compiler.incremental>

        <!-- PLUGIN -->
        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
        <dokka-maven-plugin.version>1.6.21</dokka-maven-plugin.version>
        <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
        <gpg-sign-skip>false</gpg-sign-skip>
        <enforcerSkip>true</enforcerSkip>
        <git-commit-id-maven-plugin.version>5.0.0</git-commit-id-maven-plugin.version>
        <git-commit-id-maven-plugin.skip>false</git-commit-id-maven-plugin.skip>
        <git-commit-id-maven-plugin.repository.browse-commit.url-prefix>https://github.com/infobip/kafkistry/commit/</git-commit-id-maven-plugin.repository.browse-commit.url-prefix>
        <jib-maven-plugin.version>3.3.2</jib-maven-plugin.version>
        <test-open-modules-args>--add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED</test-open-modules-args>

        <!-- DOCKER -->
        <docker.main-class>com.infobip.kafkistry.KafkistryApplication</docker.main-class>
        <jib-maven-plugin.goal>dockerBuild</jib-maven-plugin.goal>
        <docker.skip-build>true</docker.skip-build>
        <docker.from-image>eclipse-temurin:21-jdk</docker.from-image>
        <docker.to-image>infobip/kafkistry</docker.to-image>

        <!-- CENTRAL PUBLISH -->
        <maven-central.skip-publish>true</maven-central.skip-publish>

        <!-- DEPENDENCIES -->
        <kafka.version>3.9.0</kafka.version>
        <org.eclipse.jgit.version>6.10.0.202406032230-r</org.eclipse.jgit.version>
        <sshd-git.version>2.13.2</sshd-git.version> <!-- Apache MINA -->
        <jsoup.version>1.15.4</jsoup.version>
        <jslack-api-client.version>3.4.2</jslack-api-client.version>
        <zookeeper.version>3.8.3</zookeeper.version>
        <hibernate-validator.version>8.0.0.Final</hibernate-validator.version>
        <hibernate-orm.version>6.1.5.Final</hibernate-orm.version>
        <commons-pool2.version>2.8.0</commons-pool2.version>
        <guava.version>32.0.0-jre</guava.version>
        <commons-io.version>2.16.1</commons-io.version>
        <logback-gelf.version>5.0.1</logback-gelf.version>
        <awaitility.version>4.2.0</awaitility.version>
        <testcontainers-gitserver.version>0.5.0</testcontainers-gitserver.version>
        <kotlintest.version>2.0.7</kotlintest.version>
        <mockito-kotlin.version>2.2.0</mockito-kotlin.version>
        <spring-ai.version>2.0.0-M2</spring-ai.version>

    </properties>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.ai</groupId>
                <artifactId>spring-ai-bom</artifactId>
                <version>${spring-ai.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
                <!-- override synk vulnerability in 2.11.0: CWE-300 | CVE-2024-47553 | CVSS 6.9 | SNYK-JAVA-COMMONSIO-8161190 -->
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-common</artifactId>
            <version>${kotlin.version}</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>kotlinx-coroutines-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>kotlinx-coroutines-jdk8</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.kotlintest</groupId>
            <artifactId>kotlintest</artifactId>
            <version>${kotlintest.version}</version>
            <scope>test</scope>
            <exclusions>
                <!-- provides vulnerable guava version; newer guava included in project anyway -->
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.nhaarman.mockitokotlin2</groupId>
            <artifactId>mockito-kotlin</artifactId>
            <version>${mockito-kotlin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>${awaitility.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>

                <configuration>
                    <compilerPlugins>
                        <plugin>spring</plugin>
                    </compilerPlugins>
                    <jvmTarget>${kotlin.jvm.target}</jvmTarget>
                    <args>
                        <arg>-Werror</arg>
                    </args>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-allopen</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <executions>
                    <execution>
                        <id>kr-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>**/*Test.*</include>
                    </includes>
                    <excludes>
                        <exclude>**/it/**</exclude>
                    </excludes>
                    <argLine>-Djava.net.preferIPv4Stack=true ${test-open-modules-args}</argLine>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M5</version>
                <executions>
                    <execution>
                        <id>kr-integration-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!-- having default 'true' causes integration tests to fail to load Kafkistry class -->
                    <useModulePath>false</useModulePath>
                    <includes>
                        <include>**/it/**/*Test.*</include>
                        <include>**/IT*.*</include>
                        <include>**/*IT.*</include>
                        <include>**/*ITCase.*</include>
                    </includes>
                    <excludes>
                        <exclude />  <!-- inner classes were excluded by default -->
                    </excludes>
                    <argLine>-Djava.net.preferIPv4Stack=true ${test-open-modules-args}</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>${dokka-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${maven-gpg-plugin.version}</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/*.asc</exclude>
                            </excludes>
                            <skip>${gpg-sign-skip}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>test-jar</goal>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>default-cli</id>
                        <configuration>
                            <rules>
                                <dependencyConvergence />
                            </rules>
                            <skip>${enforcerSkip}</skip>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>${jib-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>${jib-maven-plugin.goal}</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skip>${docker.skip-build}</skip>
                    <from>
                        <image>${docker.from-image}</image>
                    </from>
                    <to>
                        <image>${docker.to-image}</image>
                        <tags>
                            <tag>latest</tag>
                            <tag>${project.version}</tag>
                        </tags>
                    </to>
                    <container>
                        <mainClass>${docker.main-class}</mainClass>
                    </container>
                </configuration>
            </plugin>

            <plugin>
                <groupId>io.github.git-commit-id</groupId>
                <artifactId>git-commit-id-maven-plugin</artifactId>
                <version>${git-commit-id-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
                <configuration>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <generateGitPropertiesFilename>${project.build.outputDirectory}/${project.groupId}.${project.artifactId}.git.properties</generateGitPropertiesFilename>
                    <includeOnlyProperties>
                        <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
                        <includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
                        <includeOnlyProperty>^git.commit.time$</includeOnlyProperty>
                        <includeOnlyProperty>^git.commit.message.full$</includeOnlyProperty>
                        <includeOnlyProperty>^git.remote.origin.url$</includeOnlyProperty>
                        <includeOnlyProperty>^git.closest.tag.name$</includeOnlyProperty>
                        <includeOnlyProperty>^git.closest.tag.commit.count$</includeOnlyProperty>
                    </includeOnlyProperties>
                    <replacementProperties>
                        <replacementProperty>
                            <property>maven.groupId</property>
                            <token>^.*$</token>
                            <value>${project.groupId}</value>
                            <regex>false</regex>
                        </replacementProperty>
                        <replacementProperty>
                            <property>maven.artifactId</property>
                            <token>^.*$</token>
                            <value>${project.artifactId}</value>
                            <regex>false</regex>
                        </replacementProperty>
                        <replacementProperty>
                            <property>git.remote.browse.url</property>
                            <token>^.*$</token>
                            <value>${project.url}</value>
                            <regex>false</regex>
                        </replacementProperty>
                        <replacementProperty>
                            <property>git.remote.browse.commit-prefix-url</property>
                            <token>^.*$</token>
                            <value>${git-commit-id-maven-plugin.repository.browse-commit.url-prefix}</value>
                            <regex>false</regex>
                        </replacementProperty>
                    </replacementProperties>
                    <commitIdGenerationMode>full</commitIdGenerationMode>
                    <failOnNoGitDirectory>false</failOnNoGitDirectory>
                    <skip>${git-commit-id-maven-plugin.skip}</skip>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.1.2</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.2</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.9.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>ossrh</publishingServerId>
                    <autoPublish>true</autoPublish>
                    <waitUntil>published</waitUntil>
                    <skipPublishing>${maven-central.skip-publish}</skipPublishing>
                    <deploymentName>Kafkistry public (${project.version})</deploymentName>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>multiPlatformDocker</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <jib-maven-plugin.goal>build</jib-maven-plugin.goal>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.google.cloud.tools</groupId>
                        <artifactId>jib-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <from>
                                <platforms>
                                    <platform>
                                        <architecture>amd64</architecture>
                                        <os>linux</os>
                                    </platform>
                                    <platform>
                                        <architecture>arm64</architecture>
                                        <os>linux</os>
                                    </platform>
                                </platforms>
                            </from>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

    <scm>
        <url>git@github.com:infobip/kafkistry.git</url>
        <connection>scm:git:git@github.com:infobip/kafkistry.git</connection>
        <developerConnection>scm:git:git@github.com:infobip/kafkistry.git</developerConnection>
        <tag>v0.10.0</tag>
    </scm>

    <distributionManagement>
        <repository>
            <id>ossrh</id>
            <name>SonatypeReleases</name>
            <url>https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>ossrh-snapshots</id>
            <name>SonatypeSnapshots</name>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

</project>

