<?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>

    <groupId>com.logicalclocks</groupId>
    <artifactId>hsfs-parent</artifactId>
    <packaging>pom</packaging>
    <version>4.7.4</version>
    <modules>
        <module>hsfs</module>
        <module>spark</module>
        <module>flink</module>
        <module>beam</module>
    </modules>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <guava.version>30.1.1-jre</guava.version>
        <httpclient.version>4.5.6</httpclient.version>
        <httpcore.version>4.4.13</httpcore.version>
        <slf4j.version>2.0.17</slf4j.version>
        <log4j.version>1.2.17</log4j.version>
        <handy.version>2.1.8</handy.version>
        <lombok.version>1.18.36</lombok.version>
        <lombok.plugin.version>1.18.20.0</lombok.plugin.version>
        <fasterxml.jackson.databind.version>2.10.0</fasterxml.jackson.databind.version>
        <deequ.version>1.1.0.6-SNAPSHOT</deequ.version>
        <spark.version>3.5.5</spark.version>
        <hudi.version>1.0.2</hudi.version>
        <awssdk.version>2.10.40</awssdk.version>
        <scala.version>2.12.10</scala.version>
        <scala-short.version>2.12</scala-short.version>
        <dbutils.version>0.0.5</dbutils.version>
        <json.version>20231013</json.version>
        <hoverfly.version>0.12.2</hoverfly.version>
        <junit.version>5.9.1</junit.version>
        <surefire-plugin.version>2.22.0</surefire-plugin.version>
        <mockito.version>4.3.1</mockito.version>
        <avro.version>1.11.4</avro.version>
        <commons-text.version>1.13.1</commons-text.version>
        <skipHops>true</skipHops>

        <artifact.spark.version>spark3.5</artifact.spark.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <delombok.output>${project.basedir}/delombok</delombok.output>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>

        <dependency>
            <groupId>com.damnhandy</groupId>
            <artifactId>handy-uri-templates</artifactId>
            <version>${handy.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${httpcore.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>${json.version}</version>
        </dependency>

        <dependency>
            <groupId>io.specto</groupId>
            <artifactId>hoverfly-java</artifactId>
            <version>${hoverfly.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-inline</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>${commons-text.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                </configuration>
                <executions>
                    <execution>
                        <id>scala-compile-first</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>scala-test-compile</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <!-- get all project dependencies -->
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <!-- bind to the packaging phase -->
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <configLocation>src/main/resources/checkstyle.xml</configLocation>
                    <suppressionsLocation>src/main/resources/suppressions.xml</suppressionsLocation>
                    <failOnViolation>true</failOnViolation>
                    <failsOnError>true</failsOnError>
                    <consoleOutput>true</consoleOutput>
                    <logViolationsToConsole>true</logViolationsToConsole>
                    <sourceDirectories>
                        <sourceDirectory>src/main/java</sourceDirectory>
                    </sourceDirectories>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire-plugin.version}</version>
                <configuration>
                    <systemProperties>
                        <property>
                            <name>hadoop.home.dir</name>
                            <value>${project.basedir}/src/test/resources/hadoop/</value>
                        </property>
                    </systemProperties>
                    <systemPropertiesFile>src/test/resources/system.properties</systemPropertiesFile>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-maven-plugin</artifactId>
                <version>${lombok.plugin.version}</version>
                <configuration>
                    <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
                    <outputDirectory>${delombok.output}</outputDirectory>
                    <addOutputDirectory>false</addOutputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <!-- Default configuration for all reports -->
                    <sourceFileExcludes>
                        <exclude>**/MainClass.java</exclude>
                        <!-- Currently this is not supported -->
                        <exclude>**/beam/constructor/*</exclude>
                        <exclude>**/flink/constructor/*</exclude>
                    </sourceFileExcludes>
                </configuration>
                <executions>
                    <execution>
                        <id>aggregate</id>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                        <phase>site</phase>
                        <configuration>
                            <!-- Specific configuration for the aggregate report -->
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
    </build>

    <profiles>
        <profile>
            <id>spark-3.3</id>
            <properties>
                <deequ.version>2.0.4.0-spark-3.3</deequ.version>
                <artifact.spark.version>spark3.3</artifact.spark.version>
            </properties>
        </profile>
        <profile>
            <id>spark-3.5</id>
            <properties>
                <spark.version>3.5.5</spark.version>
                <deequ.version>2.0.7-spark-3.5</deequ.version>
                <artifact.spark.version>spark3.5</artifact.spark.version>
                <fasterxml.jackson.databind.version>2.15.2</fasterxml.jackson.databind.version>
                <kafka.version>3.4.1</kafka.version>
            </properties>
        </profile>
        <!-- Needs to be included when running mvn deploy or mvn install -->
        <profile>
            <id>with-hops-ee</id>
            <properties>
                <skipHops>false</skipHops>
            </properties>
            <repositories>
                <repository>
                    <id>HopsEE</id>
                    <name>Hops Enterprise Repository</name>
                    <url>https://nexus.hops.works/repository/hops-artifacts</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>Hops</id>
            <name>Hops Repo</name>
            <url>https://archiva.hops.works/repository/Hops/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        
    </repositories>

    <distributionManagement>
        <repository>
            <id>Hops</id>
            <name>Hops Repo</name>
            <url>https://archiva.hops.works/repository/Hops/</url>
        </repository>
    </distributionManagement>
</project>
