<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2024 OpenFacade 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.github.openfacade</groupId>
    <artifactId>http-facade-parent</artifactId>
    <version>0.4.0</version>
    <packaging>pom</packaging>
    <modules>
        <module>http-facade</module>
        <module>http-facade-tests</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <src.dir>src/main/java</src.dir>
        <jacoco.overall.exec>${maven.multiModuleProjectDirectory}/target/jacoco/jacoco.exec</jacoco.overall.exec>
        <!-- dependency -->
        <annotations.version>13.0</annotations.version>
        <apache-http-client.version>5.3.1</apache-http-client.version>
        <async-http-client.version>3.0.0</async-http-client.version>
        <jetty.version>12.0.13</jetty.version>
        <junit.version>5.11.0</junit.version>
        <log4j.version>2.24.0</log4j.version>
        <lombok.version>1.18.34</lombok.version>
        <okhttp.version>4.12.0</okhttp.version>
        <reactor.version>1.1.21</reactor.version>
        <slf4j.version>2.0.16</slf4j.version>
        <tomcat.version>10.1.30</tomcat.version>
        <vertx.version>4.5.10</vertx.version>
        <!-- plugin -->
        <central-publishing-maven-plugin.version>0.5.0</central-publishing-maven-plugin.version>
        <lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
        <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-deploy-plugin.version>3.1.3</maven-deploy-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.5</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-scm-provider-gitexe.version>2.1.0</maven-scm-provider-gitexe.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.5.0</maven-surefire-plugin.version>
        <spotbugs-maven-plugin.version>4.8.6.3</spotbugs-maven-plugin.version>
        <spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>${annotations.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>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <configuration>
                    <destFile>${jacoco.overall.exec}</destFile>
                    <dataFile>${jacoco.overall.exec}</dataFile>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <configuration>
                            <append>true</append>
                        </configuration>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <configuration>
                            <excludes>**/META-INF/versions/**</excludes>
                        </configuration>
                        <phase>validate</phase>
                        <goals>
                            <goal>report</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-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>
                <executions>
                    <execution>
                        <id>compile-java-8</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <source>8</source>
                            <target>8</target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
            </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>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <useFile>false</useFile>
                </configuration>
            </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>Http Client Facade</name>
    <description>Http client abstracts multiple underlying HTTP clients, such as Jdk and OkHttp, and provides a unified API</description>
    <url>https://github.com/openfacade/http-facade</url>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

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

    <developers>
        <developer>
            <name>hezhangjian</name>
            <email>hezhangjian97@gmail.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:openfacade/http-facade.git</connection>
        <developerConnection>scm:git:git@github.com:openfacade/http-facade.git</developerConnection>
        <url>git@github.com:openfacade/http-facade.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>
