<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.community</groupId>
    <artifactId>community-hub-release-parent</artifactId>
    <version>1.4.4</version>
  </parent>
  <groupId>io.camunda.spring</groupId>
  <artifactId>spring-client-root</artifactId>
  <version>8.5.3</version>
  <packaging>pom</packaging>

  <properties>
    <project.build.resourceEncoding>${project.build.sourceEncoding}</project.build.resourceEncoding>
    <version.java>17</version.java>
    <java.version>${version.java}</java.version>

    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>

    <zeebe.version>8.5.0</zeebe.version>
    <identity.version>8.5.1</identity.version>

    <spring-boot.version>3.2.5</spring-boot.version>
    <commons-beanutils.version>1.9.4</commons-beanutils.version>
    <resilience4j.version>2.2.0</resilience4j.version>
    <jackson.version>2.16.1</jackson.version>
    <commons-lang.version>3.14.0</commons-lang.version>

    <plugin.version.maven-enforcer-plugin>3.4.1</plugin.version.maven-enforcer-plugin>

    <plugin.version.javadoc>3.1.1</plugin.version.javadoc>
    <!-- disable jdk8 javadoc checks on release build -->
    <additionalparam>-Xdoclint:none</additionalparam>

    <!-- release parent settings -->
    <nexus.snapshot.repository>https://artifacts.camunda.com/artifactory/zeebe-io-snapshots/</nexus.snapshot.repository>
    <nexus.release.repository>https://artifacts.camunda.com/artifactory/zeebe-io/</nexus.release.repository>
  </properties>

  <modules>
    <!-- Spring dependent modules -->
    <module>spring-client-annotations</module>
    <module>spring-client-common</module>
    <module>spring-client-zeebe</module>

    <!-- Spring Boot dependent modules -->
    <module>spring-boot-starter-camunda</module>

    <!--Plain Java dependent modules -->
    <module>camunda-sdk-java</module>

    <module>test/common</module>
    <module>test/embedded</module>
    <module>test/testcontainer</module>

    <module>example</module>
    <module>legacy</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-bom</artifactId>
        <version>${zeebe.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-bpmn-model</artifactId>
        <version>${zeebe.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-process-test-extension</artifactId>
        <version>${zeebe.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>zeebe-process-test-extension-testcontainer</artifactId>
        <version>${zeebe.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>spring-client-annotations</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>spring-client-common</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>spring-client-zeebe</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>java-client-operate</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>spring-client-console</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>spring-boot-starter-camunda</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>spring-boot-starter-camunda-test-common</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>spring-boot-starter-camunda-test</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda.spring</groupId>
        <artifactId>spring-boot-starter-camunda-test-testcontainer</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>identity-sdk</artifactId>
        <version>${identity.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>identity-spring-boot-starter</artifactId>
        <version>${identity.version}</version>
      </dependency>
      <dependency>
        <groupId>io.camunda</groupId>
        <artifactId>identity-spring-boot-autoconfigure</artifactId>
        <version>${identity.version}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>${jackson.version}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${jackson.version}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>${jackson.version}</version>
      </dependency>
      <dependency>
        <groupId>org.awaitility</groupId>
        <artifactId>awaitility</artifactId>
        <version>4.2.1</version>
      </dependency>
      <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>${commons-beanutils.version}</version>
      </dependency>
      <dependency>
        <groupId>io.github.resilience4j</groupId>
        <artifactId>resilience4j-retry</artifactId>
        <version>${resilience4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commons-lang.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <!-- no dependencies allowed here, specify in submodules! -->

  <build>
    <defaultGoal>clean install</defaultGoal>
    <pluginManagement>
      <plugins>
        <!-- Disable adding license header -->
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <configuration>
            <skip>true</skip>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.12.1</version>
          <configuration>
            <source>${java.version}</source>
            <target>${java.version}</target>
            <compilerVersion>${java.version}</compilerVersion>
            <fork>true</fork>
          </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
                <source>8</source>
            </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.2.5</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${plugin.version.maven-enforcer-plugin}</version>
          <configuration>
            <rules>
              <requireReleaseDeps>
                <onlyWhenRelease>true</onlyWhenRelease>
              </requireReleaseDeps>
              <requirePluginVersion />
            </rules>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>enforce</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
        <executions>
          <!-- Replacing default-compile as it is treated specially by maven -->
          <execution>
            <id>default-compile</id>
            <phase>none</phase>
          </execution>
          <!-- Replacing default-testCompile as it is treated specially by maven -->
          <execution>
            <id>default-testCompile</id>
            <phase>none</phase>
          </execution>
          <execution>
            <id>java-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>java-test-compile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.12</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>2.43.0</version>
        <configuration>
          <formats>
            <format>
              <includes>
                <include>*.md</include>
                <include>.gitignore</include>
              </includes>
              <trimTrailingWhitespace />
              <endWithNewline />
              <indent>
                <spaces>true</spaces>
                <spacesPerTab>2</spacesPerTab>
              </indent>
            </format>
          </formats>
          <java>
            <googleJavaFormat />
          </java>
          <pom />
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- profile to auto format -->
    <profile>
      <id>autoFormat</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>spotless-format</id>
                <goals>
                  <goal>apply</goal>
                </goals>
                <phase>process-sources</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- profile to perform strict validation checks -->
    <profile>
      <id>checkFormat</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>spotless-check</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>validate</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <repositories>
    <repository>
      <id>zeebe-snapshots</id>
      <name>Zeebe Snapshot Repository</name>
      <url>https://artifacts.camunda.com/artifactory/zeebe-io-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>connectors-snapshots</id>
      <name>Connectors Snapshot Repository</name>
      <url>https://artifacts.camunda.com/artifactory/connectors-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>identity</id>
      <name>Identity Repository</name>
      <url>https://artifacts.camunda.com/artifactory/camunda-identity</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <developers>
    <developer>
      <name>Jan Galinski</name>
      <organization>Holisticon AG</organization>
      <url>https://jangalinski.github.io</url>
      <roles>
        <role>initiator</role>
      </roles>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>Apache License</name>
    </license>
  </licenses>

  <scm>
    <url>https://github.com/camunda-community-hub/spring-zeebe</url>
    <connection>scm:git:git@github.com:camunda-community-hub/spring-zeebe.git</connection>
    <developerConnection>scm:git:git@github.com:camunda-community-hub/spring-zeebe.git</developerConnection>
    <tag>HEAD</tag>
  </scm>
</project>
