<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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">
    <parent>
        <groupId>org.apache</groupId>
        <artifactId>apache</artifactId>
        <version>34</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.apache.flink</groupId>
    <artifactId>flink-agents</artifactId>
    <name>Flink Agents : </name>
    <!-- TODO: build website and update url -->
    <url>https://flink.apache.org</url>
    <version>0.3.0</version>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <target.java.version>11</target.java.version>
        <maven.compiler.source>${target.java.version}</maven.compiler.source>
        <maven.compiler.target>${target.java.version}</maven.compiler.target>
        <spotless.version>2.27.1</spotless.version>
        <spotless.skip>false</spotless.skip>
        <flink.version>2.2.1</flink.version>
        <kafka.version>4.0.0</kafka.version>
        <fluss.version>0.9.0-incubating</fluss.version>
        <junit5.version>5.10.1</junit5.version>
        <jackson.version>2.18.2</jackson.version>
        <pemja.version>0.5.7</pemja.version>
        <log4j2.version>2.23.1</log4j2.version>
        <slf4j.version>1.7.36</slf4j.version>
        <assertj.version>3.27.7</assertj.version>
        <mockito.version>5.14.2</mockito.version>
        <bytebuddy.version>1.15.4</bytebuddy.version>
        <gpg.useagent>true</gpg.useagent>
        <arguments />
    </properties>

    <modules>
        <module>api</module>
        <module>examples</module>
        <module>plan</module>
        <module>runtime</module>
        <module>e2e-test</module>
        <module>integrations</module>
        <module>dist</module>
        <module>ide-support</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <!-- Jackson BOM (Bill of Materials) Unified management of all Jackson module versions -->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit5.version}</version>
            <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>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>${bytebuddy.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>java-11</id>
            <activation>
                <jdk>[11,17)</jdk>
            </activation>
            <properties>
                <target.java.version>11</target.java.version>
                <maven.compiler.source>11</maven.compiler.source>
                <maven.compiler.target>11</maven.compiler.target>
            </properties>
        </profile>

        <profile>
            <id>java-21</id>
            <activation>
                <jdk>[21,)</jdk>
            </activation>
            <properties>
                <!-- Skip spotless for jdk21, as the version of spotless plugin doesn't support jdk21. -->
                <spotless.skip>true</spotless.skip>
            </properties>
        </profile>

        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
            <properties>
                <target.java.version>11</target.java.version>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>enforce-maven</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <!-- versions for certain build tools are enforced to match the CI setup -->
                                        <!-- the rules below should stay in sync with Flink Release wiki documentation and the CI scripts -->
                                        <requireJavaVersion>
                                            <version>[${target.java.version}.*,)</version>
                                        </requireJavaVersion>
                                    </rules>
                                </configuration>
                            </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>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-release-plugin</artifactId>
                            <version>2.1</version>
                            <configuration>
                                <mavenExecutorId>forked-path</mavenExecutorId>
                                <useReleaseProfile>false</useReleaseProfile>
                                <arguments>${arguments} -Psonatype-oss-release</arguments>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <!-- used for SNAPSHOT and regular releases -->
            <id>docs-and-source</id>
            <activation>
                <property>
                    <name>docs-and-source</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <quiet>true</quiet>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                        <quiet>true</quiet>
                        <detectOfflineLinks>false</detectOfflineLinks>
                        <release>11</release>
                        <additionalJOptions>
                            <additionalJOption>-Xdoclint:none</additionalJOption>
                            <additionalJOption>--allow-script-in-comments</additionalJOption>
                            <!-- Suppress the error that is accepted by JDK 8 but not by JDK 11. -->
                            <additionalJOption>--ignore-source-errors</additionalJOption>
                        </additionalJOptions>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.version}</version>
                <configuration>
                    <skip>${spotless.skip}</skip>
                    <java>
                        <googleJavaFormat>
                            <version>1.15.0</version>
                            <style>AOSP</style>
                        </googleJavaFormat>

                        <!-- \# refers to the static imports -->
                        <importOrder>
                            <order>,javax,java,scala,\#</order>
                        </importOrder>

                        <removeUnusedImports />
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <id>spotless-check</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>
                        --add-opens=java.base/java.util=ALL-UNNAMED
                        --add-opens=java.base/java.nio=ALL-UNNAMED
                        --add-exports=java.base/jdk.internal.vm=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>