<?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" 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.camunda</groupId>
    <artifactId>camunda-release-parent</artifactId>
    <version>3.9.1</version>
    <!-- do not remove empty tag - http://jira.codehaus.org/browse/MNG-4687 -->
    <relativePath />
  </parent>

  <groupId>io.zeebe</groupId>
  <artifactId>zeebe-cluster-testbench</artifactId>
  <version>3.0.1</version>
  <packaging>pom</packaging>

  <name>Zeebe Cluster Testbench</name>
  <description>${name}</description>

  <!-- When changing the artifact or name, also make sure to change the SCM
    location below and in .ci/scripts/github-release.sh -->
  <modules>
    <module>core</module>
    <module>cloud-client</module>
    <module>internal-cloud-client</module>
    <module>testdriver/api</module>
    <module>testdriver/sequential</module>
    <module>integration-tests</module>
  </modules>

  <scm>
    <connection>scm:git:https://${GITHUB_TOKEN_USR}:${GITHUB_TOKEN_PSW}@github.com/zeebe-io/zeebe-cluster-testbench.git</connection>
    <developerConnection>scm:git:https://${GITHUB_TOKEN_USR}:${GITHUB_TOKEN_PSW}@github.com/zeebe-io/zeebe-cluster-testbench.git</developerConnection>
    <tag>3.0.1</tag>
    <url>https://github.com/zeebe-io/zeebe-cluster-testbench</url>
  </scm>

  <properties>
    <nexus.release.repository>https://app.camunda.com/nexus/content/repositories/zeebe-io/</nexus.release.repository>
    <nexus.snapshot.repository>https://app.camunda.com/nexus/content/repositories/zeebe-io-snapshots/</nexus.snapshot.repository>
    <plugin.version.build-helper>3.2.0</plugin.version.build-helper>
    <plugin.version.dependency>3.3.0</plugin.version.dependency>
    <plugin.version.flakytestextractor>2.1.1</plugin.version.flakytestextractor>
    <plugin.version.flatten>1.2.7</plugin.version.flatten>
    <plugin.version.fmt>2.13</plugin.version.fmt>
    <plugin.version.googlejavaformat>1.12.0</plugin.version.googlejavaformat>
    <plugin.version.jacoco>0.8.7</plugin.version.jacoco>
    <plugin.version.javadoc>3.3.2</plugin.version.javadoc>
    <plugin.version.maven-shade>3.2.4</plugin.version.maven-shade>
    <plugin.version.pitest>1.3.7</plugin.version.pitest>
    <plugin.version.pitest-junit5>0.15</plugin.version.pitest-junit5>
    <plugin.version.shade>3.2.4</plugin.version.shade>
    <plugin.version.spotless>2.21.0</plugin.version.spotless>
    <plugin.version.surefire>3.0.0-M5</plugin.version.surefire>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.assertj>3.22.0</version.assertj>
    <version.awaitility>4.2.0</version.awaitility>
    <version.commons-text>1.9</version.commons-text>
    <version.jackson>2.13.2</version.jackson>
    <version.java>17</version.java>
    <version.junit>5.8.2</version.junit>
    <version.log4j>2.17.2</version.log4j>
    <version.log4j-maven-shade-plugin-extensions>2.17.1</version.log4j-maven-shade-plugin-extensions>
    <version.log4j2-cachefile>2.14.1</version.log4j2-cachefile>
    <version.mockito>4.4.0</version.mockito>
    <version.resteasy>6.0.0.Final</version.resteasy>
    <version.slf4j>1.7.36</version.slf4j>
    <version.vavr>0.10.4</version.vavr>
    <version.wiremock>2.32.0</version.wiremock>
    <version.zeebe-process-test>1.4.0-alpha3-SNAPSHOT</version.zeebe-process-test>
    <version.zeebeWorkerJavaTestutils>1.3.5</version.zeebeWorkerJavaTestutils>
    <zeebe.version>1.3.5</zeebe.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.zeebe</groupId>
        <artifactId>zeebe-cluster-testbench-core</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.zeebe</groupId>
        <artifactId>zeebe-cluster-testbench-cloud-client</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.zeebe</groupId>
        <artifactId>zeebe-cluster-testbench-internal-cloud-client</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.zeebe</groupId>
        <artifactId>zeebe-cluster-testbench-internal-cloud-client</artifactId>
        <version>${project.version}</version>
        <type>test-jar</type>
      </dependency>
      <dependency>
        <groupId>io.zeebe</groupId>
        <artifactId>zeebe-cluster-testbench-testdriver-sequential</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.zeebe</groupId>
        <artifactId>zeebe-cluster-testbench-testdriver-api</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-client-java</artifactId>
        <version>${zeebe.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-test-util</artifactId>
        <version>${zeebe.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-util</artifactId>
        <version>${zeebe.version}</version>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${version.assertj}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${version.slf4j}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>${version.log4j}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>${version.log4j}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${version.log4j}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>${version.jackson}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>${version.jackson}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${version.jackson}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <version>${version.resteasy}</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson2-provider</artifactId>
        <version>${version.resteasy}</version>
      </dependency>
      <dependency>
        <groupId>io.vavr</groupId>
        <artifactId>vavr</artifactId>
        <version>${version.vavr}</version>
      </dependency>
      <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-text</artifactId>
        <version>${version.commons-text}</version>
      </dependency>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${version.junit}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${version.junit}</version>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${version.mockito}</version>
      </dependency>
      <dependency>
        <groupId>org.awaitility</groupId>
        <artifactId>awaitility</artifactId>
        <version>${version.awaitility}</version>
      </dependency>
      <dependency>
        <groupId>io.zeebe</groupId>
        <artifactId>zeebe-worker-java-testutils</artifactId>
        <version>${version.zeebeWorkerJavaTestutils}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-process-test-extension</artifactId>
        <version>${version.zeebe-process-test}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.github.tomakehurst</groupId>
        <artifactId>wiremock-jre8</artifactId>
        <version>${version.wiremock}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>zeebe</id>
      <name>Zeebe Repository</name>
      <url>https://app.camunda.com/nexus/content/repositories/zeebe-io/</url>
    </repository>
    <repository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>zeebe-snapshots</id>
      <name>Zeebe Snapshot Repository</name>
      <url>https://app.camunda.com/nexus/content/repositories/zeebe-io-snapshots/</url>
    </repository>
  </repositories>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>${plugin.version.spotless}</version>
          <configuration>
            <!-- Google code format plugin -->
            <java>
              <googleJavaFormat>
                <version>${plugin.version.googlejavaformat}</version>
                <style>GOOGLE</style>
              </googleJavaFormat>
            </java>
            <!-- SortPOM plugin -->
            <pom>
              <sortPom>
                <expandEmptyElements>false</expandEmptyElements>
                <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
                <sortProperties>true</sortProperties>
              </sortPom>
            </pom>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>apply</goal>
              </goals>
              <phase>process-sources</phase>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>${plugin.version.maven-shade}</version>
          <dependencies>
            <dependency>
              <groupId>io.github.edwgiz</groupId>
              <artifactId>log4j-maven-shade-plugin-extensions</artifactId>
              <version>${version.log4j-maven-shade-plugin-extensions}</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>com.coveo</groupId>
        <artifactId>fmt-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>eu.stamp-project</groupId>
        <artifactId>pitmp-maven-plugin</artifactId>
        <version>${plugin.version.pitest}</version>
        <configuration>
          <mutators>
            <mutator>STRONGER</mutator>
            <mutator>INLINE_CONSTS</mutator>
            <mutator>REMOVE_CONDITIONALS</mutator>
            <mutator>CONSTRUCTOR_CALLS</mutator>
            <mutator>NON_VOID_METHOD_CALLS</mutator>
            <mutator>REMOVE_INCREMENTS</mutator>
            <mutator>AOR</mutator>
            <mutator>AOD</mutator>
            <mutator>OBBN</mutator>
          </mutators>
          <excludedTestClasses>*IT</excludedTestClasses>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-junit5-plugin</artifactId>
            <version>${plugin.version.pitest-junit5}</version>
          </dependency>
        </dependencies>
      </plugin>
      <!-- flaky test extractor plugin -->
      <plugin>
        <groupId>io.zeebe</groupId>
        <artifactId>flaky-test-extractor-maven-plugin</artifactId>
        <version>${plugin.version.flakytestextractor}</version>
        <executions>
          <execution>
            <goals>
              <goal>extract-flaky-tests</goal>
            </goals>
            <phase>post-integration-test</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>${plugin.version.dependency}</version>
      </plugin>
      <!-- temporarily disabled <plugin> <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId> <version>1.4.1</version> <configuration>
        <rules> <dependencyConvergence /> </rules> </configuration> <executions>
        <execution> <phase>verify</phase> <goals> <goal>enforce</goal> </goals> </execution>
        </executions> </plugin> -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${plugin.version.javadoc}</version>
      </plugin>
      <!-- Surefire plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${plugin.version.surefire}</version>
      </plugin>
      <!-- JaCoCo Plugin -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${plugin.version.jacoco}</version>
        <executions>
          <execution>
            <id>coverage-initialize</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>coverage-report</id>
            <goals>
              <goal>report</goal>
            </goals>
            <phase>post-integration-test</phase>
          </execution>
          <!-- Threshold -->
        </executions>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${plugin.version.spotless}</version>
        <configuration>
          <markdown>
            <includes>
              <include>**/*.md</include>
            </includes>
            <excludes>
              <exclude>**/target/**/*.md</exclude>
              <exclodes>bats-core/**</exclodes>
            </excludes>
            <flexmark />
          </markdown>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>apply</goal>
            </goals>
            <phase>process-sources</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
        <version>${plugin.version.flatten}</version>
        <configuration>
          <flattenMode>ossrh</flattenMode>
          <!--
            do not change the outputDirectory; it must remain the same one as the relative project
            directory, as many plugins expect to resolve the project directory from the current POM
            file's parent, and any plugin which would run post flatten would resolve the project
            directory to the wrong one. For example, if you configure it to
            ${project.build.directory}, then any plugin after will think that the project's
            directory is not /parent/ but /parent/target, which may affect the execution of plugins
            (e.g. resource file resolution)
            -->
        </configuration>
        <executions>
          <execution>
            <id>flatten</id>
            <goals>
              <goal>flatten</goal>
            </goals>
            <phase>process-resources</phase>
          </execution>
          <execution>
            <id>flatten.clean</id>
            <goals>
              <goal>clean</goal>
            </goals>
            <phase>clean</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <properties>
        <arguments>-DskipTests</arguments>
        <developmentVersion>${env.DEVELOPMENT_VERSION}</developmentVersion>
        <gpg.passphrase>${env.GPG_PASS}</gpg.passphrase>
        <plugin.version.gpg>1.6</plugin.version.gpg>
        <releaseVersion>${env.RELEASE_VERSION}</releaseVersion>
        <resume>false</resume>
        <tag>${env.RELEASE_VERSION}</tag>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-gpg-plugin</artifactId>
              <configuration>
                <gpgArguments>
                  <arg>--pinentry-mode</arg>
                  <arg>loopback</arg>
                </gpgArguments>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>
</project>
