<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <modules>
        <module>javalin</module>
        <module>javalin-bundle</module>
        <module>javalin-testtools</module>
        <module>javalin-micrometer</module>
        <module>javalin-utils</module>
        <module>javalin-rendering</module>
        <module>javalin-ssl</module>
        <module>javalin-osgi</module>
    </modules>

    <groupId>io.javalin</groupId>
    <artifactId>javalin-parent</artifactId>
    <version>6.3.0</version>

    <name>Javalin (parent)</name>
    <description>Javalin: Simple REST APIs for Java and Kotlin</description>
    <url>https://javalin.io</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:git@github.com:javalin/javalin.git</connection>
        <developerConnection>scm:git:git@github.com:javalin/javalin.git</developerConnection>
        <url>https://github.com/javalin/javalin.git</url>
        <tag>javalin-parent-6.3.0</tag>
    </scm>
    <developers>
        <developer>
            <name>David Åse</name>
        </developer>
    </developers>
    <issueManagement>
        <system>GitHub Issue Tracker</system>
        <url>https://github.com/javalin/javalin/issues</url>
    </issueManagement>

    <distributionManagement>
        <repository>
            <id>sonatype-nexus-staging</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <name>Reposilite Maven Repository</name>
            <id>reposilite-repository</id>
            <url>https://maven.reposilite.com/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <jdk.version>11</jdk.version>

        <copy-build-resources.skip>true</copy-build-resources.skip>

        <dokka.jdkVersion>11</dokka.jdkVersion>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <kotlin.version>1.9.25</kotlin.version>
        <kotlin.compiler.jvmTarget>11</kotlin.compiler.jvmTarget>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
        <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>

        <!-- PLUGINS -->
        <compiler.plugin.version>3.13.0</compiler.plugin.version>
        <dokka.plugin.version>1.9.10</dokka.plugin.version>
        <javadoc.plugin.version>3.5.0</javadoc.plugin.version>
        <gpg.plugin.version>3.2.4</gpg.plugin.version>
        <jar.plugin.version>3.4.1</jar.plugin.version>
        <surefire.plugin.version>3.3.1</surefire.plugin.version>
        <shade.plugin.version>3.6.0</shade.plugin.version>
        <build-helper.plugin.version>3.6.0</build-helper.plugin.version>
        <enforcer.plugin.version>3.5.0</enforcer.plugin.version>
        <clean.plugin.version>3.4.0</clean.plugin.version>
        <install.plugin.version>3.1.2</install.plugin.version>
        <resources.plugin.version>3.3.1</resources.plugin.version>
        <source.plugin.version>3.3.1</source.plugin.version>
        <moditect.plugin.version>1.2.2.Final</moditect.plugin.version>
        <maven.javadoc.skip>true</maven.javadoc.skip> <!-- property used by the javadoc plugin, which is triggered by ... something in the pom -->
        <jacoco.plugin.version>0.8.12</jacoco.plugin.version>

        <!-- DEPENDENCIES -->
        <annotations.version>24.1.0</annotations.version>
        <jetty.version>11.0.23</jetty.version>
        <jetty.jakarta-api>5.0.2</jetty.jakarta-api>
        <jackson.version>2.17.2</jackson.version>
        <jackson.databind.version>2.17.2</jackson.databind.version>
        <brotli4j.version>1.16.0</brotli4j.version>
        <logback.version>1.5.7</logback.version>
        <slf4j.version>2.0.16</slf4j.version>
        <gson.version>2.11.0</gson.version>
        <okhttp.version>4.12.0</okhttp.version> <!-- Also used for testing in SSL plugin -->

        <!-- SSL DEPENDENCIES -->
        <sslcontext-kickstart.version>8.3.6</sslcontext-kickstart.version>

        <!-- TEST DEPENDENCIES -->
        <assertj.version>3.26.3</assertj.version>
        <moshi.version>1.15.1</moshi.version>
        <java.websocket.version>1.5.6</java.websocket.version>
        <junit.version>5.10.3</junit.version>
        <jmh.version>1.37</jmh.version>
        <mockito.version>5.12.0</mockito.version>
        <mockk.version>1.13.12</mockk.version>
        <unirest.version>3.14.5</unirest.version>
        <selenium.chrome.driver.version>4.20.0</selenium.chrome.driver.version>
        <webdrivermanager.version>5.9.2</webdrivermanager.version>
        <swagger.ui.version>4.10.3</swagger.ui.version> <!-- used for testing webjars -->
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib-jdk8</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <!-- Kotlin -->
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-stdlib-jdk8</artifactId>
                <version>${kotlin.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-reflect</artifactId>
                <version>${kotlin.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-stdlib-common</artifactId>
                <version>${kotlin.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-stdlib</artifactId>
                <version>${kotlin.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jetbrains</groupId>
                <artifactId>annotations</artifactId>
                <version>${annotations.version}</version>
                <scope>provided</scope>
            </dependency>
            <!-- Logging -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>

            <!-- Jetty -->
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-bom</artifactId>
                <version>${jetty.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- SSL Plugin -->
            <dependency>
                <groupId>io.github.hakky54</groupId>
                <artifactId>sslcontext-kickstart</artifactId>
                <version>${sslcontext-kickstart.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.hakky54</groupId>
                <artifactId>sslcontext-kickstart-for-jetty</artifactId>
                <version>${sslcontext-kickstart.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.hakky54</groupId>
                <artifactId>sslcontext-kickstart-for-pem</artifactId>
                <version>${sslcontext-kickstart.version}</version>
            </dependency>

            <!-- BEGIN Optional dependencies -->
            <dependency>
                <groupId>com.aayushatharva.brotli4j</groupId>
                <artifactId>brotli4j</artifactId>
                <version>${brotli4j.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-databind</artifactId>
                <version>${jackson.databind.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-kotlin</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jsr310</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>${okhttp.version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp-tls</artifactId>
                <version>${okhttp.version}</version>
            </dependency>
            <!-- END Optional dependencies -->
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/java</sourceDir>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                            </sourceDirs>
                            <args>
                                <arg>-Xjvm-default=all</arg>
                            </args>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                                <sourceDir>${project.basedir}/src/test/java</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${compiler.plugin.version}</version>
                <executions>
                    <!-- Replacing default-compile as it is treated specially by maven -->
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                    <!-- Replacing default-testCompile as it is treated specially by maven -->
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>java-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>java-test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <release>${jdk.version}</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${resources.plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy-license</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/../</directory>
                                    <includes>
                                        <include>LICENSE</include>
                                    </includes>
                                </resource>
                            </resources>
                            <skip>${copy-build-resources.skip}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-pom-properties</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <propertiesEncoding>${project.build.sourceEncoding}</propertiesEncoding>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/../</directory>
                                    <includes>
                                        <include>pom.properties</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                            <skip>${copy-build-resources.skip}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${source.plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${clean.plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${install.plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${resources.plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${compiler.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.jetbrains.dokka</groupId>
                    <artifactId>dokka-maven-plugin</artifactId>
                    <version>${dokka.plugin.version}</version>
                    <configuration>
                        <jdkVersion>${dokka.jdkVersion}</jdkVersion>
                        <sourceDirectories>
                            <dir>${project.basedir}/src/main/java</dir>
                            <dir>${project.basedir}/src/main/kotlin</dir>
                        </sourceDirectories>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <id>attach-javadocs-dokka</id>
                            <goals>
                                <goal>javadocJar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.junit.jupiter</groupId>
                            <artifactId>junit-jupiter-engine</artifactId>
                            <version>${junit.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <rerunFailingTestsCount>2</rerunFailingTestsCount>
                        <properties>
                            <configurationParameters>
                                junit.jupiter.execution.timeout.default = 1m
                            </configurationParameters>
                        </properties>
                        <!--
                        default: **/*$*
                        Source: https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#excludes

                        Not removing this default causes roots tests mixed with nested tests to be not executed by
                        Maven.
                        Similar JUnit issue: https://github.com/junit-team/junit5/issues/1377
                        -->
                        <excludes>
                            <exclude />
                        </excludes>
                        <useModulePath>false</useModulePath>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${jar.plugin.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Build-Time>${maven.build.timestamp}</Build-Time>
                            </manifestEntries>
                            <pomPropertiesFile>${project.build.directory}/pom.properties</pomPropertiesFile>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${source.plugin.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Build-Time>${maven.build.timestamp}</Build-Time>
                            </manifestEntries>
                            <pomPropertiesFile>${project.build.directory}/pom.properties</pomPropertiesFile>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${shade.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${build-helper.plugin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>kotlin-maven-plugin</artifactId>
                    <groupId>org.jetbrains.kotlin</groupId>
                    <version>${kotlin.version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${gpg.plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.moditect</groupId>
                    <artifactId>moditect-maven-plugin</artifactId>
                    <version>${moditect.plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>sonatype-oss-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>pre-site</phase>
                                <goals>
                                    <goal>dokka</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>${enforcer.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>enforce-maven</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireJavaVersion>
                                            <message>Current JDK version ${java.version} - Should be ${jdk.version}x</message>
                                            <version>[${jdk.version}, ${jdk.version}.999)</version>
                                        </requireJavaVersion>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
