<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>curacao</groupId>
    <artifactId>curacao-parent</artifactId>
    <version>7.1.3</version>
    <packaging>pom</packaging>

    <properties>
        <project.java-source.version>11</project.java-source.version>
        <project.java-runtime.version>[11,)</project.java-runtime.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.javadoc.skip>true</maven.javadoc.skip>

        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-clean-plugin.version>3.4.0</maven-clean-plugin.version>
        <maven-versions-plugin.version>2.17.1</maven-versions-plugin.version>
        <maven-surefire-plugin.version>3.5.1</maven-surefire-plugin.version>
        <maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-war-plugin.version>3.4.0</maven-war-plugin.version>
        <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
        <maven-pmd-plugin.version>3.28.0</maven-pmd-plugin.version>
        <maven-pmd-plugin.pmd.version>7.25.0</maven-pmd-plugin.pmd.version>
        <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
        <maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>

        <jakarta.servlet-api.version>6.1.0</jakarta.servlet-api.version>
        <javax.servlet-api.version>4.0.1</javax.servlet-api.version>

        <kolich-common.version>0.5</kolich-common.version>
        <reflections.version>0.10.2</reflections.version>

        <guava.version>33.6.0-jre</guava.version>
        <gson.version>2.14.0</gson.version>

        <config.version>1.4.8</config.version>

        <jsr305.version>3.0.2</jsr305.version>

        <commons-lang3.version>3.20.0</commons-lang3.version>
        <commons-io.version>2.22.0</commons-io.version>
        <commons-codec.version>1.22.0</commons-codec.version>

        <jackson.version>2.21.4</jackson.version>
        <jackson-annotations.version>2.21</jackson-annotations.version>

        <async-http-client.version>3.0.10</async-http-client.version>

        <slf4j-api.version>2.0.18</slf4j-api.version>
        <logback.version>1.5.33</logback.version>

        <jetty-9.version>9.4.56.v20240826</jetty-9.version>
        <jetty-11.version>11.0.26</jetty-11.version>

        <checkstyle.version>13.4.2</checkstyle.version>

        <junit-jupiter.version>6.1.0</junit-jupiter.version>
        <mockito-core.version>5.14.2</mockito-core.version>
    </properties>

    <organization>
        <name>Mark Kolich</name>
        <url>https://github.com/markkolich/curacao</url>
    </organization>

    <developers>
        <developer>
            <id>markkolich</id>
            <name>Mark Kolich</name>
            <url>https://mark.koli.ch</url>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>-8</timezone>
        </developer>
    </developers>

    <modules>
        <module>curacao</module>

        <module>curacao-servlet</module>
        <module>curacao-servlet-jakarta</module>
        <module>curacao-servlet-javax</module>

        <module>curacao-gson</module>
        <module>curacao-jackson</module>

        <module>curacao-examples</module>

        <module>curacao-embedded</module>
    </modules>

    <dependencyManagement>
        <dependencies>

            <!-- ###################### -->
            <!-- 2nd party dependencies -->
            <!-- ###################### -->

            <dependency>
                <groupId>curacao</groupId>
                <artifactId>curacao</artifactId>
                <version>7.1.3</version>
            </dependency>

            <dependency>
                <groupId>curacao</groupId>
                <artifactId>curacao-servlet</artifactId>
                <version>7.1.3</version>
            </dependency>
            <dependency>
                <groupId>curacao</groupId>
                <artifactId>curacao-servlet-jakarta</artifactId>
                <version>7.1.3</version>
            </dependency>
            <dependency>
                <groupId>curacao</groupId>
                <artifactId>curacao-servlet-javax</artifactId>
                <version>7.1.3</version>
            </dependency>

            <dependency>
                <groupId>curacao</groupId>
                <artifactId>curacao-gson</artifactId>
                <version>7.1.3</version>
            </dependency>
            <dependency>
                <groupId>curacao</groupId>
                <artifactId>curacao-jackson</artifactId>
                <version>7.1.3</version>
            </dependency>

            <dependency>
                <groupId>curacao</groupId>
                <artifactId>curacao-examples</artifactId>
                <version>7.1.3</version>
            </dependency>

            <dependency>
                <groupId>curacao</groupId>
                <artifactId>curacao-embedded</artifactId>
                <version>7.1.3</version>
            </dependency>

            <!-- ###################### -->
            <!-- 3rd party dependencies -->
            <!-- ###################### -->

            <dependency>
                <groupId>jakarta.servlet</groupId>
                <artifactId>jakarta.servlet-api</artifactId>
                <version>${jakarta.servlet-api.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>${javax.servlet-api.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>com.kolich</groupId>
                <artifactId>kolich-common</artifactId>
                <version>${kolich-common.version}</version>
            </dependency>

            <dependency>
                <groupId>org.reflections</groupId>
                <artifactId>reflections</artifactId>
                <version>${reflections.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>dom4j</groupId>
                        <artifactId>dom4j</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.google.guava</groupId>
                        <artifactId>guava</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>com.google.code.findbugs</groupId>
                        <artifactId>annotations</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.code.findbugs</groupId>
                        <artifactId>jsr305</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson.version}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson-annotations.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <dependency>
                <groupId>com.typesafe</groupId>
                <artifactId>config</artifactId>
                <version>${config.version}</version>
            </dependency>

            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>${jsr305.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>

            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>

            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${commons-codec.version}</version>
            </dependency>

            <dependency>
                <groupId>org.asynchttpclient</groupId>
                <artifactId>async-http-client</artifactId>
                <version>${async-http-client.version}</version>
            </dependency>

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j-api.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>

            <!-- ###################### -->
            <!-- Test dependencies -->
            <!-- ###################### -->

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>${junit-jupiter.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-params</artifactId>
                <version>${junit-jupiter.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${junit-jupiter.version}</version>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>

            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <release>11</release>
                        <compilerArgs>
                            <arg>-Xlint:all</arg>
                            <arg>-Xlint:-processing</arg>
                            <arg>-Xlint:-serial</arg>
                            <arg>-Xlint:-try</arg>
                            <arg>-Xdiags:verbose</arg>
                            <arg>-Werror</arg>
                        </compilerArgs>
                        <showWarnings>true</showWarnings>
                        <showDeprecation>true</showDeprecation>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <systemPropertyVariables>
                            <!-- Keeps the Surefire "ForkedBooter" from popping up in the MacOS dock. -->
                            <java.awt.headless>true</java.awt.headless>
                            <!-- Forces unit tests to run in the context of a known timezone: PST/PDT. -->
                            <user.timezone>America/Los_Angeles</user.timezone>
                        </systemPropertyVariables>
                        <argLine>--add-exports java.xml/jdk.xml.internal=ALL-UNNAMED</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${maven-checkstyle-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>verify-style</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <configLocation>build/checkstyle/config.xml</configLocation>
                        <violationSeverity>warning</violationSeverity>
                        <failOnViolation>true</failOnViolation>
                        <failsOnError>true</failsOnError>
                        <!-- Validate source files in src/test/java too -->
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <!--consoleOutput>true</consoleOutput-->
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${maven-pmd-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>net.sourceforge.pmd</groupId>
                            <artifactId>pmd-core</artifactId>
                            <version>${maven-pmd-plugin.pmd.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>net.sourceforge.pmd</groupId>
                            <artifactId>pmd-java</artifactId>
                            <version>${maven-pmd-plugin.pmd.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>pmd-check</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <printFailingErrors>true</printFailingErrors>
                        <includeTests>true</includeTests>
                        <failOnViolation>true</failOnViolation>
                        <linkXRef>false</linkXRef>
                        <targetJdk>${project.java-source.version}</targetJdk>
                        <rulesets>
                            <!--
                                HACK: Using `${session.executionRootDirectory}` to reference the directory in
                                which Maven was invoked. This is intentional as the `maven-pmd-plugin`
                                does not have a way to reference a single path relative to the project/module
                                directory. So it's either use this hack, or `ln -s` a soft link pointing at the
                                root `build/pmd/ruleset.xml` file in EVERY project/module.

                                ((Same hack below for the `versions-maven-plugin`, btw))
                            -->
                            <ruleset>file:///${session.executionRootDirectory}/build/pmd/ruleset.xml</ruleset>
                        </rulesets>
                        <excludeRoots>
                            <excludeRoot>target/generated-sources</excludeRoot>
                        </excludeRoots>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                </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>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>../dist/${project.artifactId}/${project.version}</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven-war-plugin.version}</version>
                </plugin>

            </plugins>

        </pluginManagement>

        <plugins>
            <!-- Delete the top level dist/ directory on clean. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>${maven-clean-plugin.version}</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>dist</directory>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <!-- Copies the resulting POM from the sub-module into the dist/ directory. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>${maven-dependency-plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy-artifact</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>${project.artifactId}</artifactId>
                                    <version>${project.version}</version>
                                    <type>pom</type>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>dist/${project.artifactId}/${project.version}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!--
                `mvn versions:display-dependency-updates`: dump a list of dependencies that need upgrading.
                `mvn versions:display-plugin-updates`: dump a list of plugin dependencies that need upgrading.
            -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>${maven-versions-plugin.version}</version>
                <configuration>
                    <ignoredVersions>.*-M.*,.*-alpha.*</ignoredVersions>
                    <allowSnapshots>false</allowSnapshots>
                    <!--
                        HACK: Using `${session.executionRootDirectory}` to reference the directory in
                        which Maven was invoked. This is intentional as the `versions-maven-plugin`
                        does not have a way to reference a single path relative to the project/module
                        directory. So it's either use this hack, or `ln -s` a soft link pointing at the
                        root `build/versions/rules.xml` file in EVERY project/module.

                        For reference:
                        https://github.com/mojohaus/versions-maven-plugin/issues/258#issuecomment-383021337
                    -->
                    <rulesUri>file:///${session.executionRootDirectory}/build/versions/rules.xml</rulesUri>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>markkolich.github.io</id>
            <name>markkolich.github.io</name>
            <url>https://markkolich.github.io/repo</url>
            <releases />
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>
