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

    Copyright Kroxylicious Authors.

    Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-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>

    <groupId>io.kroxylicious.testing</groupId>
    <artifactId>testing-parent</artifactId>
    <version>0.8.1</version>
    <packaging>pom</packaging>

    <name>Kroxylicious Testing Parent</name>
    <description>Provisioning of Kafka clusters</description>
    <inceptionYear>2022</inceptionYear>
    <url>https://github.com/kroxylicious/kroxylicious-junit5-extension</url>

    <licenses>
        <license>
            <name>Apache-2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Tom Bentley</name>
            <email>tbentley@redhat.com</email>
            <organization>Red Hat</organization>
            <organizationUrl>https://www.redhat.com</organizationUrl>
        </developer>
        <developer>
            <name>Sam Barker</name>
            <email>sbarker@redhat.com</email>
            <organization>Red Hat</organization>
            <organizationUrl>https://www.redhat.com</organizationUrl>
            <timezone>Pacific/Auckland</timezone>
        </developer>
        <developer>
            <name>Keith Wall</name>
            <email>kwall@redhat.com</email>
            <organization>Red Hat</organization>
            <organizationUrl>https://www.redhat.com</organizationUrl>
        </developer>
        <developer>
            <name>Francisco Vila</name>
            <email>fvila@redhat.com</email>
            <organization>Red Hat</organization>
            <organizationUrl>https://www.redhat.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:kroxylicious/kroxylicious-junit5-extension.git</connection>
        <developerConnection>scm:git:git@github.com:kroxylicious/kroxylicious-junit5-extension.git</developerConnection>
        <url>https://github.com/kroxylicious/kroxylicious-junit5-extension</url>
    </scm>

    <modules>
        <module>api</module>
        <module>impl</module>
        <module>junit5-extension</module>
        <module>integration-test</module>
    </modules>

    <properties>
        <java.version>17</java.version>
        <java.test.version>17</java.test.version>
        <maven.compiler.parameters>true</maven.compiler.parameters>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <maven.compiler.testRelease>${java.test.version}</maven.compiler.testRelease>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>

        <skipTests>false</skipTests>
        <skipITs>${skipTests}</skipITs>
        <skipUTs>${skipTests}</skipUTs>

        <junit.version>5.10.1</junit.version>
        <kafka.version>3.6.1</kafka.version>
        <testcontainers.version>1.19.3</testcontainers.version>
        <lombok.version>1.18.30</lombok.version>
        <assertj-core.version>3.25.1</assertj-core.version>
        <spotbugs-annotations.version>4.8.3</spotbugs-annotations.version>
        <zookeeper.version>3.8.3</zookeeper.version>
        <log4j.version>2.22.1</log4j.version>
        <awaitility.version>4.2.0</awaitility.version>
        <duct-tape.version>1.0.8</duct-tape.version>
        <mockito.version>5.8.0</mockito.version>
        <moby-names-generator.version>20.10.1-r0</moby-names-generator.version>

        <!-- Required for JDK 21 compatibility, remove dependency management for byte-buddy once assertj bumps to a newer bytebuddy -->
        <byte-buddy.version>1.14.11</byte-buddy.version>
        <!-- Avoids issues with ryuk when running with podman https://github.com/containers/podman/issues/7927#issuecomment-731525556 -->
        <testcontainers.ryuk.disabled>true</testcontainers.ryuk.disabled>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.kroxylicious.testing</groupId>
                <artifactId>testing-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.kroxylicious.testing</groupId>
                <artifactId>testing-junit5-extension</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.kroxylicious.testing</groupId>
                <artifactId>testing-impl</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>${testcontainers.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-bom</artifactId>
                <version>${log4j.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-clients</artifactId>
                <version>${kafka.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka_2.13</artifactId>
                <version>${kafka.version}</version>
                <exclusions>
                    <!-- Pulled in transitively via Zookeeper-->
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>ch.qos.logback</groupId>
                        <artifactId>logback-classic</artifactId>
                    </exclusion>
                </exclusions>
                <scope>provided</scope>
            </dependency>
            <!-- org.apache.kafka.server.common.MetadataVersion.MINIMUM_BOOTSTRAP_VERSION -->
            <dependency>
                <groupId>org.apache.kafka</groupId>
                <artifactId>kafka-server-common</artifactId>
                <version>${kafka.version}</version>
                <scope>provided</scope>
            </dependency>



            <dependency>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
                <version>${zookeeper.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>ch.qos.logback</groupId>
                        <artifactId>logback-classic</artifactId>
                    </exclusion>
                </exclusions>
                <!-- The user needs to provide this dependency only if they wish to use in-VM kafka with a Zookeeper
                     controller.  If they are using in-VM kafka in KRaft node, or container kafka with Zookeeper, it is not
                     required. -->
                <scope>provided</scope>
                <optional>true</optional> <!-- MNG-5227 -->
            </dependency>
            <dependency>
                <groupId>org.awaitility</groupId>
                <artifactId>awaitility</artifactId>
                <version>${awaitility.version}</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj-core.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
            <dependency>
                <groupId>org.rnorth.duct-tape</groupId>
                <artifactId>duct-tape</artifactId>
                <version>${duct-tape.version}</version>
            </dependency>
            <dependency>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-annotations</artifactId>
                <version>${spotbugs-annotations.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-bom</artifactId>
                <version>${mockito.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>net.bytebuddy</groupId>
                <artifactId>byte-buddy</artifactId>
                <version>${byte-buddy.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>info.schnatterer.moby-names-generator</groupId>
                <artifactId>moby-names-generator</artifactId>
                <version>${moby-names-generator.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <!-- Keep alphabetic order -->
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>4.3</version>
                    <configuration>
                        <strictCheck>true</strictCheck>
                        <licenseSets>
                            <licenseSet>
                                <!--suppress MavenModelInspection -->
                                <header>${session.executionRootDirectory}/etc/license.txt</header>
                                <excludes>
                                    <exclude>LICENSE.txt</exclude>
                                    <exclude>**/.dontdelete</exclude>
                                </excludes>
                            </licenseSet>
                        </licenseSets>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>2.23.0</version>
                    <configuration>
                        <!--suppress MavenModelInspection -->
                        <configFile>${session.executionRootDirectory}/etc/eclipse-formatter-config.xml</configFile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code</groupId>
                    <artifactId>impsort-maven-plugin</artifactId>
                    <version>1.9.0</version>
                    <configuration>
                        <groups>java.,javax.,org.,com.,io.,*,io.kroxylicious</groups>
                        <removeUnused>true</removeUnused>
                        <staticAfter>true</staticAfter>
                        <compliance>${java.test.version}</compliance>
                    </configuration>
                    <executions>
                        <execution>
                            <id>sort-imports</id>
                            <goals>
                                <goal>${impsort-maven-plugin.goal}</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.12.1</version>
                    <configuration>
                        <parameters>true</parameters>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.3.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.6.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.4.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.2.3</version>
                    <configuration>
                        <skipTests>${skipITs}</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.6.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>3.10.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.12.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.2.3</version>
                    <configuration>
                        <skipTests>${skipUTs}</skipTests>
                        <trimStackTrace>false</trimStackTrace>
                        <environmentVariables>
                            <TESTCONTAINERS_RYUK_DISABLED>${testcontainers.ryuk.disabled}</TESTCONTAINERS_RYUK_DISABLED>
                        </environmentVariables>
                        <systemPropertyVariables>
                            <container.logs.dir>${project.build.directory}/container-logs/</container.logs.dir>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.commonjava.maven.plugins</groupId>
                    <artifactId>directory-maven-plugin</artifactId>
                    <version>1.0</version>
                </plugin>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-plugin-plugin</artifactId>
                                        <versionRange>[3.6.0,)</versionRange>
                                        <goals>
                                            <goal>descriptor</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore/>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.commonjava.maven.plugins</groupId>
                                        <artifactId>directory-maven-plugin</artifactId>
                                        <versionRange>[0.3.1,)</versionRange>
                                        <goals>
                                            <goal>highest-basedir</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore/>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>qa</id>
            <activation>
                <property>
                    <name>!quick</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>format</id>
                                <goals>
                                    <goal>format</goal>
                                </goals>
                                <phase>process-sources</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>enforce-plugin-versions</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireJavaVersion>
                                            <version>[${java.version},)</version>
                                        </requireJavaVersion>
                                        <requirePluginVersions>
                                            <banLatest>true</banLatest>
                                            <banRelease>true</banRelease>
                                            <banSnapshots>false</banSnapshots>
                                            <phases>clean,deploy,site</phases>
                                        </requirePluginVersions>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <includePom>true</includePom>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <links>
                                        <link>https://junit.org/junit5/docs/${junit.version}/api/</link>
                                    </links>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.commonjava.maven.plugins</groupId>
                        <artifactId>directory-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>resolve-rootdir</id>
                                <goals>
                                    <goal>highest-basedir</goal>
                                </goals>
                                <phase>initialize</phase>
                                <configuration>
                                    <property>rootdir</property>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- note CI is deliberately defined after qa so that it can replace the formatter config plugin -->
            <!-- see https://maven.apache.org/guides/introduction/introduction-to-profiles.html#profile-order -->
            <id>ci</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>validate-formatting</id>
                                <goals>
                                    <goal>validate</goal>
                                </goals>
                                <phase>process-sources</phase>
                            </execution>
                            <execution>
                                <id>format</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>quick</id>
            <activation>
                <property>
                    <name>quick</name>
                </property>
            </activation>
            <properties>
                <skipTests>true</skipTests>
            </properties>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <!--suppress UnresolvedMavenProperty -->
                                    <keyname>${releaseSigningKey}</keyname>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>3.1.1</version>
                        <executions>
                            <execution>
                                <id>default-deploy</id>
                                <phase>none</phase>
                            </execution>
                            <execution>
                                <id>deploy-artefacts</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                                <configuration>
                                    <deployAtEnd>true</deployAtEnd>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>enforce-property</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireProperty>
                                            <property>releaseSigningKey</property>
                                            <message>You must specify your GPG key when running a release</message>
                                        </requireProperty>
                                        <requireReleaseDeps>
                                            <message>No Snapshots Allowed!</message>
                                        </requireReleaseDeps>
                                        <requireReleaseVersion>
                                            <message>Ensure all modules have a release version</message>
                                        </requireReleaseVersion>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
</project>
