<?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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.flink</groupId>
        <artifactId>flink-connector-http-parent</artifactId>
        <version>1.0.0-2.2</version>
    </parent>

    <artifactId>flink-connector-http</artifactId>
    <name>Flink : Connectors : http</name>
    <version>1.0.0-2.2</version>

    <packaging>jar</packaging>

    <properties>
        <flink.connector.module.config><!--
        FlinkKafkaProducerBaseTest --> --add-opens=java.base/java.lang=ALL-UNNAMED <!--
        FlinkKafkaProducerBaseTest --> --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED <!--
        FlinkKafkaConsumerBaseTest --> --add-opens=java.base/java.util=ALL-UNNAMED <!--
        KafkaProducerExactlyOnceITCase -->
            --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
        </flink.connector.module.config>
    </properties>

    <scm>
        <url>https://github.com/apache/flink-connector-http</url>
        <connection>git@github.com:apache/flink-connector-http.git</connection>
        <developerConnection>
            scm:git:https://gitbox.apache.org/repos/asf/flink-connector-http.git
        </developerConnection>
    </scm>

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

    <dependencies>
        <!-- Apache Flink dependencies -->
        <!-- These dependencies are provided, because they should not be packaged into the JAR file. -->
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-annotations</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-metrics-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-table-runtime</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-json</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-core-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-shaded-jackson</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Table ecosystem -->

        <!-- Projects depending on this project won't depend on flink-table-*. -->
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-table-api-java-bridge</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-table-api-java</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-table-common</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.vavr</groupId>
            <artifactId>vavr</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-retry</artifactId>
        </dependency>

        <dependency>
            <groupId>io.github.resilience4j</groupId>
            <artifactId>resilience4j-core</artifactId>
        </dependency>

        <!--http table factory testing -->
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-connector-base</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-connector-base</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <scope>test</scope>
        </dependency>

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

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-inline</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-runtime</artifactId>
            <version>${flink.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-clients</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-table-common</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <!-- brings in junit 5.10.1 which mismatches our junit so we need to exclude it-->
        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-test-utils-junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-streaming-java</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

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

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

        <dependency>
            <groupId>org.apache.flink</groupId>
            <artifactId>flink-table-planner_${scala.binary.version}</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.minidev</groupId>
            <artifactId>json-smart</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.wiremock</groupId>
            <artifactId>wiremock</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>net.javacrumbs.json-unit</groupId>
            <artifactId>json-unit-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId> com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- enables TCP/IP communication between surefire and forked JVM-->
                    <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
                    <trimStackTrace>false</trimStackTrace>
                    <systemPropertyVariables>
                        <forkNumber>0${surefire.forkNumber}</forkNumber>
                        <!-- $$ ensures that surefire resolves this to the current forkNumber,
                             instead of maven during initialization -->
                        <mvn.forkNumber>$${surefire.forkNumber}</mvn.forkNumber>
                        <user.country>US</user.country>
                        <user.language>en</user.language>
                        <project.basedir>${project.basedir}</project.basedir>
                        <junit.jupiter.extensions.autodetection.enabled>true</junit.jupiter.extensions.autodetection.enabled>
                    </systemPropertyVariables>
                    <argLine>-Xms256m -Xmx2048m -XX:+UseG1GC</argLine>
                </configuration>
                <executions>
                    <execution>
                        <!--execute all the unit tests-->
                        <id>default-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>${test.unit.pattern}</include>
                            </includes>
                            <excludes>
                                <exclude>${additionalExcludes}</exclude>
                            </excludes>
                            <!--
                             The default forkCount from the parent pom is 4. This runs all the unit tests 4 times,
                             Each run of the unit tests as competing for the WireMockServer port, so we were seeing
                             errors where the port was already being used. forCount 1 means we run the unit tests once
                             and there is no port contention.
                             -->
                            <forkCount>1</forkCount>
                            <argLine>${flink.surefire.baseArgLine} -Xmx${flink.XmxUnitTest}</argLine>
                        </configuration>
                    </execution>

                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>

            <plugin>
                <!-- activate API compatibility checks -->
                <groupId>io.github.zentol.japicmp</groupId>
                <artifactId>japicmp-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>analyze-deps</id>
                        <goals>
                            <goal>analyze</goal>
                        </goals>
                        <phase>verify</phase>
                        <configuration>
                            <failOnWarning>true</failOnWarning>
                            <ignoreAllNonTestScoped>true</ignoreAllNonTestScoped>
                            <ignoredDependencies>
                                <!--These dependencies are required for the unit tests to succeed  -->
                                <ignoredDependency>org.mockito:mockito-inline:jar:5.2.0</ignoredDependency>
                                <ignoredDependency>net.bytebuddy:byte-buddy:jar:1.14.17</ignoredDependency>
                                <ignoredDependency>com.google.guava:guava:jar:32.0.1-jre</ignoredDependency>
                                <ignoredDependency>org.apache.flink:flink-clients:jar:2.2.0</ignoredDependency>
                                <ignoredDependency>org.apache.flink:flink-streaming-java:jar:2.2.0</ignoredDependency>
                                <ignoredDependency>net.javacrumbs.json-unit:json-unit-core:jar:2.40.1</ignoredDependency>
                                <ignoredUnusedDeclaredDependencies>org.apache.flink:flink-table-planner_${scala.binary.version}
                                </ignoredUnusedDeclaredDependencies>
                                <ignoredDependency>org.apache.flink:flink-table-test-utils:jar:1.20.0</ignoredDependency>
                            </ignoredDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-banned-deps</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                       <exclude>com.google.guava:guava</exclude>
                                        <!--
                                        TODO - need to remove Mockito from the unit test code
                                       <exclude>org.mockito</exclude>
                                       -->
                                        <exclude>org.powermock</exclude>
                                    </excludes>
                                    <includes>
                                        <include>com.google.guava:guava:*:*:test</include>
                                    </includes>
                                </bannedDependencies>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>