<?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>18</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.apache.rocketmq</groupId>
    <artifactId>rocketmq-client-java-parent</artifactId>
    <packaging>pom</packaging>
    <version>5.0.7</version>
    <modules>
        <module>client-apis</module>
        <module>client</module>
        <module>client-shade</module>
        <module>test</module>
    </modules>

    <properties>
        <!-- Make it compatible with Java8 -->
        <maven.compiler.release>8</maven.compiler.release>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <project.root>${basedir}</project.root>

        <rocketmq.sdk.wrapper.version>None</rocketmq.sdk.wrapper.version>
        <!--
           ~ Before add new dependencies, Here is what you should pay more attention to:
           ~  1. Whether it is essential, because the current shaded jar is fat enough.
           ~  2. Make sure that it is compatible with Java 8.
         -->
        <rocketmq-proto.version>2.0.3</rocketmq-proto.version>
        <annotations-api.version>6.0.53</annotations-api.version>
        <protobuf.version>3.21.7</protobuf.version>
        <grpc.version>1.50.0</grpc.version>
        <guava.version>31.1-jre</guava.version>
        <slf4j.version>1.7.30</slf4j.version>
        <logback.version>1.2.9</logback.version>
        <commons-lang3.version>3.4</commons-lang3.version>
        <opentelemetry.version>1.14.0</opentelemetry.version>
        <future-coverter-java8-guava.version>1.2.0</future-coverter-java8-guava.version>

        <junit.version>4.13.2</junit.version>
        <assertj-core.version>2.6.0</assertj-core.version>
        <mockito-core.version>3.10.0</mockito-core.version>
        <awaitility.version>4.1.0</awaitility.version>
        <bcpkix.version>1.77</bcpkix.version>

        <!-- plugin -->
        <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
        <spotbugs-plugin.version>4.2.2</spotbugs-plugin.version>
        <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
        <maven-checkstyle-plugin.version>3.1.1</maven-checkstyle-plugin.version>
        <maven-enforcer-plugin.version>3.2.1</maven-enforcer-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
        <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>apache.snapshots.https</id>
            <url>https://repository.apache.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>apache.staging.https</id>
            <url>https://repository.apache.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>rocketmq-client-apis</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>rocketmq-client-java-noshade</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>rocketmq-client-java</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.rocketmq</groupId>
                <artifactId>rocketmq-proto</artifactId>
                <version>${rocketmq-proto.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>io.grpc</groupId>
                        <artifactId>grpc-protobuf</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>io.grpc</groupId>
                        <artifactId>grpc-stub</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>io.grpc</groupId>
                        <artifactId>grpc-netty-shaded</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.tomcat</groupId>
                        <artifactId>annotations-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>annotations-api</artifactId>
                <version>${annotations-api.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java-util</artifactId>
                <version>${protobuf.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.errorprone</groupId>
                        <artifactId>error_prone_annotations</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.google.code.gson</groupId>
                        <artifactId>gson</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-netty-shaded</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-protobuf</artifactId>
                <version>${grpc.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.protobuf</groupId>
                        <artifactId>protobuf-java</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-stub</artifactId>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-testing</artifactId>
                <scope>test</scope>
                <version>${grpc.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.errorprone</groupId>
                        <artifactId>error_prone_annotations</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>io.opentelemetry</groupId>
                <artifactId>opentelemetry-api</artifactId>
                <version>${opentelemetry.version}</version>
            </dependency>
            <dependency>
                <groupId>io.opentelemetry</groupId>
                <artifactId>opentelemetry-sdk</artifactId>
                <version>${opentelemetry.version}</version>
            </dependency>
            <dependency>
                <groupId>io.opentelemetry</groupId>
                <artifactId>opentelemetry-exporter-otlp-metrics</artifactId>
                <version>${opentelemetry.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.squareup.okhttp3</groupId>
                        <artifactId>okhttp</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>net.javacrumbs.future-converter</groupId>
                <artifactId>future-converter-java8-guava</artifactId>
                <version>${future-coverter-java8-guava.version}</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj-core.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito-core.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.awaitility</groupId>
                <artifactId>awaitility</artifactId>
                <version>${awaitility.version}</version>
                <scope>test</scope>
            </dependency>
            <!-- https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk18on -->
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk18on</artifactId>
                <version>${bcpkix.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs-plugin.version}</version>
                <executions>
                    <execution>
                        <id>check</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <failOnError>true</failOnError>
                    <fork>false</fork>
                    <spotbugsXmlOutput>true</spotbugsXmlOutput>
                    <excludeFilterFile>${project.root}/style/spotbugs-suppressions.xml
                    </excludeFilterFile>
                    <threshold>Low</threshold>
                    <effort>Max</effort>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <!-- attached to Maven test phase -->
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>**/example/**/*.class</exclude>
                    </excludes>
                    <rules>
                        <rule>
                            <element>CLASS</element>
                            <excludes>
                                <exclude>JAVAC.SYNTHCLASS</exclude>
                                <exclude>JAVAC.SYNTHMETH</exclude>
                            </excludes>
                        </rule>
                        <rule>
                            <element>BUNDLE</element>
                            <limits>
                                <limit>
                                    <counter>LINE</counter>
                                    <value>COVEREDRATIO</value>
                                    <minimum>0.05</minimum>
                                </limit>
                            </limits>
                        </rule>
                    </rules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <configuration>
                    <consoleOutput>true</consoleOutput>
                    <encoding>UTF-8</encoding>
                    <configLocation>style/checkstyle.xml</configLocation>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>11</version>
                                </requireJavaVersion>
                                <dependencyConvergence />
                                <!-- Ban lombok -->
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>org.projectlombok:*</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <scm>
        <url>git@github.com:apache/rocketmq-clients.git</url>
        <connection>scm:git:git@github.com:apache/rocketmq-clients.git</connection>
        <developerConnection>scm:git:git@github.com:apache/rocketmq-clients.git</developerConnection>
        <tag>rocketmq-client-java-parent-5.0.7</tag>
    </scm>
</project>