<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2024 openGemini Authors

    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>io.opengemini</groupId>
    <artifactId>opengemini-client-parent</artifactId>
    <version>0.3.2</version>
    <packaging>pom</packaging>
    <modules>
        <module>opengemini-client</module>
        <module>opengemini-client-api</module>
        <module>opengemini-client-common</module>
        <module>opengemini-client-reactor</module>
        <module>spring</module>
    </modules>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <maven.compiler.testSource>8</maven.compiler.testSource>
        <maven.compiler.testTarget>8</maven.compiler.testTarget>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <src.dir>src/main/java</src.dir>
        <!-- dependency -->
        <annotations.version>13.0</annotations.version>
        <async-http-client.version>3.0.0.Beta3</async-http-client.version>
        <commons-lang3.version>3.17.0</commons-lang3.version>
        <http-facade.version>0.2.1</http-facade.version>
        <jackson.version>2.17.2</jackson.version>
        <junit.version>5.11.1</junit.version>
        <kotlin.version>1.9.22</kotlin.version>
        <lombok.version>1.18.34</lombok.version>
        <log4j.version>2.20.0</log4j.version>
        <maven-scm-provider-gitexe.version>2.1.0</maven-scm-provider-gitexe.version>
        <mockito.version>5.13.0</mockito.version>
        <okhttp.version>4.12.0</okhttp.version>
        <puppycrawl.version>10.18.1</puppycrawl.version>
        <reactor-netty.version>1.1.21</reactor-netty.version>
        <scala.version>3.4.0</scala.version>
        <slf4j.version>2.0.7</slf4j.version>
        <spring.version>6.0.19</spring.version>
        <spring-boot.version>3.1.11</spring-boot.version>
        <!-- plugin -->
        <central-publishing-maven-plugin.version>0.6.0</central-publishing-maven-plugin.version>
        <lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-checkstyle-plugin.version>3.5.0</maven-checkstyle-plugin.version>
        <maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
        <maven-enforce-plugin-maven.version>3.8.0</maven-enforce-plugin-maven.version>
        <maven-gpg-plugin.version>3.2.6</maven-gpg-plugin.version>
        <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>3.10.0</maven-javadoc-plugin.version>
        <maven-release-plugin.version>3.1.1</maven-release-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.5.0</maven-surefire-plugin.version>
        <nexus-staging-plugin.version>1.6.13</nexus-staging-plugin.version>
        <scala-maven-plugin.version>4.9.2</scala-maven-plugin.version>
        <spotbugs-maven-plugin.version>4.8.6.4</spotbugs-maven-plugin.version>
        <spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-bom</artifactId>
                <version>${log4j.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit.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>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j2-impl</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.github.openfacade</groupId>
            <artifactId>http-facade</artifactId>
            <version>${http-facade.version}</version>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>${src.dir}</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>${maven-enforce-plugin-maven.version}</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <testSource>${maven.compiler.testSource}</testSource>
                    <testTarget>${maven.compiler.testTarget}</testTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
            </plugin>
            <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>${puppycrawl.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <configLocation>ci/checkstyle/checkstyle.xml</configLocation>
                    <suppressionsLocation>./ci/checkstyle/suppressions.xml</suppressionsLocation>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <inputEncoding>UTF-8</inputEncoding>
                    <outputEncoding>UTF-8</outputEncoding>
                    <excludes>**/proto/*</excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs-maven-plugin.version}</version>
                <configuration>
                    <xmlOutput>true</xmlOutput>
                    <failOnError>true</failOnError>
                    <excludeFilterFile>ci/spotbugs/exclude.xml</excludeFilterFile>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless-maven-plugin.version}</version>
                <configuration>
                    <java>
                        <importOrder>
                            <order>,java,static others</order>
                        </importOrder>
                        <removeUnusedImports/>
                        <trimTrailingWhitespace/>
                        <endWithNewline/>
                        <indent>
                            <spaces>true</spaces>
                            <spacesPerTab>4</spacesPerTab>
                        </indent>
                    </java>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven-release-plugin.version}</version>
                <configuration>
                    <localCheckout>true</localCheckout>
                    <pushChanges>false</pushChanges>
                    <mavenExecutorId>forked-path</mavenExecutorId>
                    <arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>${maven-scm-provider-gitexe.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <sourcepath>${src.dir}</sourcepath>
                    <doclint>all,-missing</doclint>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-java-docs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${central-publishing-maven-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <tokenAuth>true</tokenAuth>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <name>OpenGemini client</name>
    <description>OpenGemini client a powerful and easy-to-use client for OpenGemini.</description>
    <url>https://github.com/openGemini/opengemini-client-java</url>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <organization>
        <name>openGemini</name>
        <url>https://github.com/openGemini</url>
    </organization>

    <developers>
        <developer>
            <name>shoothzj</name>
            <email>shoothzj@gmail.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:openGemini/opengemini-client-java.git</connection>
        <developerConnection>scm:git:git@github.com:openGemini/opengemini-client-java.git</developerConnection>
        <url>git@github.com:openGemini/opengemini-client-java.git</url>
        <tag>HEAD</tag>
    </scm>

    <profiles>
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <passphraseServerId>${gpg.passphrase}</passphraseServerId>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>delombok</id>
            <properties>
                <src.dir>${project.build.directory}/generated-sources/delombok</src.dir>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok-maven-plugin</artifactId>
                        <version>${lombok-maven-plugin.version}</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                                <version>${lombok.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>delombok</goal>
                                </goals>
                                <configuration>
                                    <addOutputDirectory>false</addOutputDirectory>
                                    <sourceDirectory>src/main/java</sourceDirectory>
                                    <formatPreferences>
                                        <pretty/>
                                    </formatPreferences>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
