<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2024 Confluent Inc.
-->
<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>io.confluent.flink</groupId>
    <artifactId>confluent-flink-plugin-parent</artifactId>
    <packaging>pom</packaging>
    <name>Confluent Flink Plugin :</name>
    <version>1.20-56</version>

    <modules>
        <module>confluent-flink-table-api-java-plugin</module>
        <module>confluent-flink-table-api-python-plugin</module>
    </modules>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <okhttp.version>4.12.0</okhttp.version>
        <gson.version>2.11.0</gson.version>
        <findbugs.version>3.0.2</findbugs.version>
        <gsonfire.version>1.9.0</gsonfire.version>
        <javax.version>1.3.2</javax.version>
        <flink.version>1.20.0</flink.version>
        <jupiter.version>5.10.3</jupiter.version>
        <assertj.version>3.26.3</assertj.version>
        <checkstyle.version>9.3</checkstyle.version>
        <checkstyle.config.location>${maven.multiModuleProjectDirectory}/etc/checkstyle.xml</checkstyle.config.location>
        <maven-openapi-plugin.version>7.8.0</maven-openapi-plugin.version>
        <maven-spotless-plugin.version>2.43.0</maven-spotless-plugin.version>
        <maven-checkstyle-plugin.version>3.2.2</maven-checkstyle-plugin.version>
        <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
    </properties>

    <repositories>
        <repository>
            <id>apache.snapshots</id>
            <name>Apache Development Snapshot Repository</name>
            <url>https://repository.apache.org/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <!-- Test infra -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>${jupiter.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${jupiter.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-params</artifactId>
                <version>${jupiter.version}</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>${maven-antrun-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${maven-spotless-plugin.version}</version>
                <configuration>
                    <ratchetFrom>origin/master</ratchetFrom>
                    <java>
                        <googleJavaFormat>
                            <version>1.24.0</version>
                            <style>AOSP</style>
                        </googleJavaFormat>

                        <!-- \# refers to the static imports -->
                        <importOrder>
                            <order>io.confluent,org.apache.flink,,javax,java,scala,\#</order>
                        </importOrder>

                        <licenseHeader>
                            <file>${maven.multiModuleProjectDirectory}/etc/license.header</file>
                            <delimiter>package</delimiter>
                        </licenseHeader>

                        <removeUnusedImports/>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <id>spotless-check</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Checkstyle -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${checkstyle.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <configLocation>${maven.multiModuleProjectDirectory}/etc/checkstyle.xml</configLocation>
                    <logViolationsToConsole>true</logViolationsToConsole>
                    <failOnViolation>true</failOnViolation>
                </configuration>
            </plugin>

            <!-- Temporarily disabled due to build issues
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <version>0.13</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <consoleOutput>true</consoleOutput>
                    <excludeSubProjects>false</excludeSubProjects>
                    <numUnapprovedLicenses>0</numUnapprovedLicenses>
                    <licenses>
                        <!- - Enforce this license:
                            Copyright 2023 Confluent Inc.

                            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.
                        - ->
                        <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
                            <licenseFamilyCategory>AL2</licenseFamilyCategory>
                            <licenseFamilyName>Apache License 2.0</licenseFamilyName>
                            <notes/>
                            <patterns>
                                <pattern>Licensed under the Apache License, Version 2.0</pattern>
                            </patterns>
                        </license>
                        <!- - Enforce this license:
                            Copyright 2023 Confluent Inc.
                        - ->
                        <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
                            <licenseFamilyCategory>CFLT</licenseFamilyCategory>
                            <licenseFamilyName>Confluent Copyright</licenseFamilyName>
                            <notes/>
                            <patterns>
                                <pattern>Copyright 2022 Confluent Inc.</pattern>
                                <pattern>Copyright 2023 Confluent Inc.</pattern>
                                <pattern>Copyright 2024 Confluent Inc.</pattern>
                            </patterns>
                        </license>
                    </licenses>
                    <licenseFamilies>
                        <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
                            <familyName>Apache License 2.0</familyName>
                        </licenseFamily>
                        <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
                            <familyName>Confluent Copyright</familyName>
                        </licenseFamily>
                    </licenseFamilies>
                    <excludes>
                        <!- - Additional files like .gitignore etc.- ->
                        <exclude>**/.*/**</exclude>
                        <exclude>**/README.md</exclude>
                        <exclude>**/*.iml</exclude>
                        <exclude>Makefile</exclude>
                        <exclude>mk-include/**</exclude>
                        <exclude>**/target/**</exclude>
                        <exclude>build-target/**</exclude>
                        <exclude>service.yml</exclude>
                        <exclude>release.svg</exclude>
                        <exclude>**/openapi.yaml</exclude>
                        <exclude>confluent-flink-plugin-private-*.json</exclude>
                        <exclude>confluent-flink-plugin-private-*.txt</exclude>
                        <exclude>**/*.properties</exclude>
                    </excludes>
                </configuration>
            </plugin>
            -->
        </plugins>

        <extensions>
            <extension>
                <groupId>io.confluent.flink</groupId>
                <artifactId>aws-maven</artifactId>
                <version>5.0.1.INTERNAL</version>
            </extension>
        </extensions>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>checkstyle-aggregate</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

</project>
