<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.camunda.community</groupId>
        <artifactId>community-hub-release-parent</artifactId>
        <version>1.3.1</version>
        <relativePath/>
    </parent>

    <groupId>io.zeebe.zeeqs</groupId>
    <artifactId>zeeqs-root</artifactId>
    <version>2.7.0</version>
    <name>ZeeQS - Root</name>
    <description>Query API for aggregated Zeebe data</description>

    <modules>
        <module>data</module>
        <module>graphql-api</module>
        <module>hazelcast-importer</module>
        <module>app</module>
    </modules>

    <properties>
        <kotlin.version>1.8.0</kotlin.version>

        <zeebe.version>8.1.6</zeebe.version>

        <spring.boot.version>2.7.8</spring.boot.version>

        <hazelcast.exporter.version>1.2.1</hazelcast.exporter.version>
        <!-- pin Hazelcast version because of spring-boot-dependencies -->
        <version.hazelcast>5.2.1</version.hazelcast>

        <zeebe-test-container.version>3.5.2</zeebe-test-container.version>
        <test-container.version>1.17.6</test-container.version>

        <!-- release parent settings -->
        <version.java>17</version.java>
        <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>

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

        <jib-maven-plugin.version>3.3.1</jib-maven-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>io.zeebe.zeeqs</groupId>
                <artifactId>data</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>io.zeebe.zeeqs</groupId>
                <artifactId>graphql-api</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>io.zeebe.zeeqs</groupId>
                <artifactId>hazelcast-importer</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>io.camunda</groupId>
                <artifactId>zeebe-bom</artifactId>
                <version>${zeebe.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-graphql</artifactId>
                <version>${spring.boot.version}</version>
            </dependency>

            <dependency>
                <groupId>io.zeebe.hazelcast</groupId>
                <artifactId>zeebe-hazelcast-connector</artifactId>
                <version>${hazelcast.exporter.version}</version>
            </dependency>

            <dependency>
                <groupId>com.hazelcast</groupId>
                <artifactId>hazelcast</artifactId>
                <version>${version.hazelcast}</version>
            </dependency>

            <dependency>
                <groupId>io.zeebe</groupId>
                <artifactId>zeebe-test-container</artifactId>
                <version>${zeebe-test-container.version}</version>
            </dependency>

            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${test-container.version}</version>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>postgresql</artifactId>
                <version>${test-container.version}</version>
            </dependency>

            <dependency>
                <groupId>org.awaitility</groupId>
                <artifactId>awaitility-kotlin</artifactId>
                <version>4.2.0</version>
            </dependency>

            <!-- Kotlin deps -->

            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-stdlib</artifactId>
                <version>${kotlin.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-stdlib-common</artifactId>
                <version>${kotlin.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-reflect</artifactId>
                <version>${kotlin.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <!-- common dependencies -->
    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-reflect</artifactId>
        </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>
                <configuration>
                    <args>
                        <arg>-Xjsr305=strict</arg>
                    </args>
                    <compilerPlugins>
                        <plugin>spring</plugin>
                        <plugin>jpa</plugin>
                    </compilerPlugins>
                    <jvmTarget>11</jvmTarget>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-allopen</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-noarg</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>

                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- Override java source version to workaround javadoc bug https://bugs.openjdk.java.net/browse/JDK-8212233 -->
                    <source>8</source>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>io.zeebe.hazelcast</groupId>
                            <artifactId>zeebe-hazelcast-exporter</artifactId>
                            <version>${hazelcast.exporter.version}</version>
                            <type>jar</type>
                            <classifier>jar-with-dependencies</classifier>
                            <overWrite>true</overWrite>
                            <outputDirectory>${project.build.directory}/exporter</outputDirectory>
                            <destFileName>zeebe-hazelcast-exporter.jar</destFileName>
                        </artifactItem>
                    </artifactItems>
                    <outputDirectory>${project.build.directory}/libs</outputDirectory>
                    <overWriteReleases>false</overWriteReleases>
                    <overWriteSnapshots>true</overWriteSnapshots>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>empty-javadoc-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>javadoc</classifier>
                            <classesDirectory>${basedir}/javadoc</classesDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.google.cloud.tools</groupId>
                    <artifactId>jib-maven-plugin</artifactId>
                    <version>${jib-maven-plugin.version}</version>
                    <configuration>
                        <to>
                            <image>ghcr.io/camunda-community-hub/zeeqs</image>
                            <tags>${project.version}</tags>
                        </to>
                    </configuration>
                </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-project-info-reports-plugin</artifactId>
                    <version>3.4.2</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.13</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>community-action-maven-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <!-- Prevent gpg from using pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

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

        <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>
    </repositories>

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

</project>
