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

    Copyright © 2026 DataSQRL (contact@datasqrl.com)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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.datasqrl.flinkrunner</groupId>
  <artifactId>flink-sql-runner-parent</artifactId>
  <version>0.10.3</version>
  <packaging>pom</packaging>

  <name>Flink SQL Runner</name>
  <description>Flink SQL Runner: A tool for running Flink SQL scripts easily.</description>
  <url>https://github.com/DataSQRL/flink-sql-runner/</url>

  <inceptionYear>2024</inceptionYear>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Daniel Henneberger</name>
      <email>daniel@datasqrl.com</email>
      <url>https://github.com/henneberger</url>
    </developer>

    <developer>
      <name>Marvin Froeder</name>
      <email>marvin@datasqrl.com</email>
      <url>https://github.com/velo</url>
    </developer>

    <developer>
      <name>Ferenc Csaky</name>
      <email>ferenc@datasqrl.com</email>
      <url>https://github.com/ferenc-csaky</url>
    </developer>
  </developers>

  <modules>
    <module>env-utils</module>
    <module>formats</module>
    <module>stdlib</module>
    <module>connectors</module>
    <module>testing</module>
    <module>flink-sql-runner</module>
    <module>flink-sql-runner-dependencies</module>
  </modules>

  <scm>
    <connection>scm:git:git://github.com/DataSQRL/flink-sql-runner.git</connection>
    <developerConnection>scm:git:git@github.com:DataSQRL/flink-sql-runner.git</developerConnection>
    <tag>HEAD</tag>
    <url>https://github.com/DataSQRL/flink-sql-runner</url>
  </scm>

  <distributionManagement>
    <snapshotRepository>
      <id>github</id>
      <url>https://maven.pkg.github.com/DataSQRL/flink-sql-runner</url>
    </snapshotRepository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>

    <!-- Flink versions -->
    <flink.version>2.2.1</flink.version>
    <flink.version.label>flink-2.2</flink.version.label>
    <flink-base-image>${flink.version}-java17</flink-base-image>
    <flink.cdc.version>3.6.0-2.2</flink.cdc.version>
    <http.conn.version>0.25.0</http.conn.version>
    <jdbc.conn.version>4.0.0-2.0</jdbc.conn.version>
    <kafka.conn.version>5.0.0-2.2</kafka.conn.version>

    <!-- Dependency versions -->
    <assertj.version>3.27.7</assertj.version>
    <auto.service.version>1.1.1</auto.service.version>
    <awaitility.version>4.3.0</awaitility.version>
    <aws-msk-iam-auth.version>2.3.7</aws-msk-iam-auth.version>
    <classgraph.version>4.8.184</classgraph.version>
    <commons-exec.version>1.6.0</commons-exec.version>
    <commons-math3.version>3.6.1</commons-math3.version>
    <feign.version>13.5</feign.version>
    <hadoop.version>3.3.4</hadoop.version>
    <iceberg.version>1.11.0</iceberg.version>
    <jackson.version>2.22.0</jackson.version>
    <jacoco.version>0.8.15</jacoco.version>
    <jdbi3.version>3.53.0</jdbi3.version>
    <json-path.version>3.0.0</json-path.version>
    <junit.version>6.1.0</junit.version>
    <log4j.version>2.26.0</log4j.version>
    <lombok.version>1.18.46</lombok.version>
    <mockito.version>5.23.0</mockito.version>
    <netty.version>4.1.126.Final</netty.version>
    <nextbreakpoint.flink.client.version>1.1.4</nextbreakpoint.flink.client.version>
    <picocli.version>4.7.7</picocli.version>
    <postgres.version>42.7.11</postgres.version>
    <slf4j.version>1.7.36</slf4j.version>
    <testcontainers.version>2.0.5</testcontainers.version>

    <!-- Plugin versions -->
    <build-helper-maven-plugin.version>3.6.1</build-helper-maven-plugin.version>
    <central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>
    <exec-maven-plugin.version>3.6.3</exec-maven-plugin.version>
    <flatten-maven-plugin.version>1.7.3</flatten-maven-plugin.version>
    <license-maven-plugin.version>5.0.0</license-maven-plugin.version>
    <maven-antrun-plugin.version>3.2.0</maven-antrun-plugin.version>
    <maven-dependency-plugin.version>3.11.0</maven-dependency-plugin.version>
    <maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>
    <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
    <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
    <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
    <maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
    <spotless-maven-plugin>3.1.0</spotless-maven-plugin>
    <sundr-maven-plugin.version>0.300.0</sundr-maven-plugin.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.fasterxml.jackson</groupId>
        <artifactId>jackson-bom</artifactId>
        <version>${jackson.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

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

      <dependency>
        <groupId>com.google.auto.service</groupId>
        <artifactId>auto-service</artifactId>
        <version>${auto.service.version}</version>
      </dependency>

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

      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>${log4j.version}</version>
      </dependency>

      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j.version}</version>
      </dependency>

      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>${log4j.version}</version>
      </dependency>

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

      <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>testcontainers-postgresql</artifactId>
        <version>${testcontainers.version}</version>
      </dependency>

      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>${hadoop.version}</version>
        <exclusions>
          <exclusion>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
          </exclusion>
          <exclusion>
            <groupId>ch.qos.reload4j</groupId>
            <artifactId>reload4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-reload4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-mapreduce-client-core</artifactId>
        <version>${hadoop.version}</version>
        <exclusions>
          <exclusion>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
          </exclusion>
          <exclusion>
            <groupId>ch.qos.reload4j</groupId>
            <artifactId>reload4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-reload4j</artifactId>
          </exclusion>
          <exclusion>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Common provided dependencies -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Common test dependencies-->
    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-launcher</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${assertj.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-junit-jupiter</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>${spotless-maven-plugin}</version>
        </plugin>

        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>${license-maven-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>io.sundr</groupId>
          <artifactId>sundr-maven-plugin</artifactId>
          <version>${sundr-maven-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>${maven-antrun-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven-enforcer-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven-dependency-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven-gpg-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <show>public</show>
            <failOnError>false</failOnError>
            <detectOfflineLinks>false</detectOfflineLinks>
            <doclint>all,-missing</doclint>
            <nohelp>true</nohelp>
            <excludePackageNames>*.internal.*,testutil,demo</excludePackageNames>
            <quiet>true</quiet>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${build-helper-maven-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>${central-publishing-maven-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <configuration>
          <pom>
            <sortPom>
              <expandEmptyElements>false</expandEmptyElements>
            </sortPom>
          </pom>
          <java>
            <excludes>
              <exclude>**/org/apache/flink/**/*.java</exclude>
            </excludes>
            <googleJavaFormat/>
            <removeUnusedImports/>
          </java>
        </configuration>
        <executions>
          <execution>
            <id>spotless-default</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>validate</phase>
          </execution>
          <execution>
            <id>spotless-flink</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>validate</phase>
            <configuration>
              <java combine.self="override">
                <includes>
                  <include>**/org/apache/flink/**/*.java</include>
                </includes>
                <googleJavaFormat>
                  <version>1.10.0</version>
                  <style>AOSP</style>
                </googleJavaFormat>
                <!-- \# refers to the static imports -->
                <importOrder>
                  <order>org.apache.flink,org.apache.flink.shaded,,javax,java,scala,\#</order>
                </importOrder>
                <removeUnusedImports/>
              </java>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <configuration>
          <properties>
            <owner>DataSQRL</owner>
            <email>contact@datasqrl.com</email>
            <year>2026</year>
          </properties>
          <licenseSets>
            <licenseSet>
              <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
              <excludes>
                <exclude>**/src/test/resources/**</exclude>
                <exclude>**/m2e-target/**</exclude>
                <exclude>**/bin/**</exclude>
                <exclude>**/org/apache/flink/**/*.java</exclude>
              </excludes>
            </licenseSet>
          </licenseSets>
          <strictCheck>true</strictCheck>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin-git</artifactId>
            <version>${license-maven-plugin.version}</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>ban-sqrl-dependencies</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <searchTransitive>true</searchTransitive>
                  <excludes>
                    <exclude>com.datasqrl:*:*</exclude>
                  </excludes>
                  <message>SQRL depends on this project, so we can't have circular dependencies</message>
                </bannedDependencies>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
          <execution>
            <id>ban-slf4j2-dependencies</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <searchTransitive>true</searchTransitive>
                  <excludes>
                    <!-- Ban SLF4J 2.x bridge to ensure only SLF4J 1.x is used -->
                    <exclude>org.apache.logging.log4j:log4j-slf4j2-impl</exclude>
                    <exclude>org.slf4j:slf4j-reload4j</exclude>
                  </excludes>
                  <message>SLF4J 2.x is not allowed. Use log4j-slf4j-impl instead of log4j-slf4j2-impl</message>
                </bannedDependencies>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <forkCount>0.5C</forkCount>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.marvinformatics.jacoco</groupId>
        <artifactId>easy-jacoco-maven-plugin</artifactId>
        <version>0.1.4</version>
        <configuration>
          <projectRules>
            <rule>
              <limits>
                <limit>
                  <counter>INSTRUCTION</counter>
                  <value>COVEREDRATIO</value>
                  <minimum>0.70</minimum>
                </limit>
              </limits>
            </rule>
          </projectRules>
          <projectExtraProperties>
            <license.skip>true</license.skip>
            <spotless.check.skip>true</spotless.check.skip>
          </projectExtraProperties>
        </configuration>
      </plugin>

      <plugin>
        <groupId>io.sundr</groupId>
        <artifactId>sundr-maven-plugin</artifactId>
        <inherited>false</inherited>
        <configuration>
          <boms>
            <bom>
              <artifactId>flinkrunner-bom</artifactId>
              <name>flinkrunner-bom</name>

              <properties>
                <license.skip>true</license.skip>
                <spotless.check.skip>true</spotless.check.skip>
              </properties>

              <modules>
                <includes>
                  <include>com.datasqrl.flinkrunner:*</include>
                </includes>
              </modules>
            </bom>
          </boms>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate-bom</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- Skip code format, license checks, tests, and enforced rules -->
    <profile>
      <id>fast</id>
      <activation>
        <property>
          <name>fast</name>
        </property>
      </activation>
      <properties>
        <skipTests>true</skipTests>
        <enforcer.skip>true</enforcer.skip>
        <maven.javadoc.skip>true</maven.javadoc.skip>
        <license.skip>true</license.skip>
        <spotless.check.skip>true</spotless.check.skip>
      </properties>
    </profile>

    <!-- Extra tasks only meant to be executed by CI -->
    <profile>
      <id>ci</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </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>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- helper profile to proper configure eclipse -->
      <id>m2e</id>
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <build>
        <directory>${project.basedir}/m2e-target</directory>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-source</id>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <phase>generate-sources</phase>
                <configuration>
                  <sources>
                    <source>target/generated-sources/annotations</source>
                    <source>target/generated-sources/java</source>
                    <source>${basedir}/src/main/flink119</source>
                  </sources>
                </configuration>
              </execution>
              <execution>
                <id>add-google-auto</id>
                <goals>
                  <goal>add-resource</goal>
                </goals>
                <phase>generate-sources</phase>
                <configuration>
                  <resources>
                    <resource>
                      <directory>target/classes</directory>
                      <excludes>
                        <exclude>**/*.class</exclude>
                      </excludes>
                    </resource>
                  </resources>
                </configuration>
              </execution>
              <execution>
                <id>add-test-source</id>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <phase>generate-test-sources</phase>
                <configuration>
                  <sources>
                    <source>target/generated-test-sources/test-annotations</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>

              <excludeArtifacts>
                <!-- artifacts that only exists to support integration tests and as samples-->
                <excludeArtifact>helpers</excludeArtifact>
                <excludeArtifact>system-functions-sample</excludeArtifact>
                <excludeArtifact>udf-sample</excludeArtifact>
              </excludeArtifacts>

              <autoPublish>true</autoPublish>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
