<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright The mod_cluster Project Authors
  ~ SPDX-License-Identifier: Apache-2.0
  -->
<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.jboss.mod_cluster</groupId>
        <artifactId>mod_cluster-bom</artifactId>
        <version>2.1.0.Final</version>
        <relativePath>bom</relativePath>
    </parent>

    <artifactId>mod_cluster-parent</artifactId>
    <name>mod_cluster (parent)</name>
    <packaging>pom</packaging>

    <description>mod_cluster is an intelligent native Apache httpd-based and pure-Java Undertow-based load-balancer</description>
    <url>https://www.modcluster.io</url>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://repository.jboss.org/licenses/apache-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:modcluster/mod_cluster.git</connection>
        <developerConnection>scm:git:git@github.com:modcluster/mod_cluster.git</developerConnection>
        <url>https://github.com/modcluster/mod_cluster</url>
        <tag>2.1.0.Final</tag>
    </scm>

    <modules>
        <module>bom</module>
        <module>core</module>
        <module>container</module>
        <module>load-spi</module>
        <module>dist</module>
    </modules>

    <properties>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.source>17</maven.compiler.source>

        <!-- Common dependencies -->
        <version.jboss-logging>3.6.1.Final</version.jboss-logging>
        <version.jboss-logging-processor>3.0.3.Final</version.jboss-logging-processor>
        <version.jcip-annotations>1.0</version.jcip-annotations>

        <!-- Test dependencies -->
        <version.junit>4.13.2</version.junit>
        <version.mockito>5.14.2</version.mockito>

        <!-- Plugin versions -->
        <version.org.wildfly.checkstyle-config>1.0.8.Final</version.org.wildfly.checkstyle-config>
        <version.org.jacoco.jacoco-maven-plugin>0.8.12</version.org.jacoco.jacoco-maven-plugin>
    </properties>

    <profiles>
        <!-- Code coverage report using JaCoCo -->
        <profile>
            <id>coverage</id>
            <activation>
                <property>
                    <name>coverage</name>
                </property>
            </activation>
            <modules>
                <module>code-coverage</module>
            </modules>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>jacoco-prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- Include the code-coverage module during release to keep module versions synchronized -->
        <profile>
            <id>jboss-release</id>
            <modules>
                <module>code-coverage</module>
            </modules>
        </profile>
    </profiles>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging</artifactId>
                <version>${version.jboss-logging}</version>
            </dependency>
            <dependency>
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging-processor</artifactId>
                <version>${version.jboss-logging-processor}</version>
            </dependency>
            <dependency>
                <groupId>net.jcip</groupId>
                <artifactId>jcip-annotations</artifactId>
                <version>${version.jcip-annotations}</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${version.junit}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${version.mockito}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

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

    <build>
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
            </resource>
            <resource>
                <directory>${project.build.sourceDirectory}</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>org.jboss.logging</groupId>
                                    <artifactId>jboss-logging-processor</artifactId>
                                    <version>${version.jboss-logging-processor}</version>
                                </path>
                                <path>
                                    <groupId>org.jboss.logging</groupId>
                                    <artifactId>jboss-logging</artifactId>
                                    <version>${version.jboss-logging}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- The Tomcat container integration modules use the *same* package and class names which are not discerned by an aggregate Javadoc report.
                         Thus, the following skippedModules should be a comma separated list of all non-latest Tomcat modules (artifactId) to not add in aggregated Javadoc.
                         See https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html#skippedModules -->
                    <skippedModules>mod_cluster-container-tomcat-9.0,mod_cluster-container-tomcat-10.1</skippedModules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>check-style</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>checkstyle</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.wildfly.checkstyle</groupId>
                            <artifactId>wildfly-checkstyle-config</artifactId>
                            <version>${version.org.wildfly.checkstyle-config}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <linkXRef>false</linkXRef>
                        <configLocation>wildfly-checkstyle/checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <excludes>**/*$logger.java,**/*$bundle.java</excludes>
                        <useFile />
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${version.org.jacoco.jacoco-maven-plugin}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
