<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>quarkus-devui-parent</artifactId>
        <groupId>io.quarkus</groupId>
        <version>4.0.0.CR1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>quarkus-devui-deployment</artifactId>
    <name>Quarkus - Dev UI - Deployment</name>

    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-devui</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-vertx-http-deployment</artifactId>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-devui-deployment-spi</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-devjsonrpc-deployment</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-devmcp-deployment</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-devui-resources</artifactId>
        </dependency>
        <dependency>
            <groupId>io.mvnpm</groupId>
            <artifactId>importmap</artifactId>
        </dependency>
        <!-- Used for the dev ui. Note that there is no corresponding runtime dependency -->
        <dependency>
            <groupId>io.quarkus.qute</groupId>
            <artifactId>qute-core</artifactId>
        </dependency>
        <dependency>
            <groupId>tools.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-devtools-common</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.maven.resolver</groupId>
                    <artifactId>maven-resolver-connector-basic</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-devui-test-spi</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-junit-internal</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-web-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <!--
                These tests all use QuarkusDevModeTest, which creates and (imperfectly) tears down
                deployment ClassLoaders. Running all of them in a single JVM accumulates enough
                leaked ClassLoaders to exhaust metaspace/heap (OOME, e.g. DevMcpTest in CI).
                We split them across several surefire executions so each runs in its own, shorter-lived
                JVM fork, keeping the number of ClassLoaders alive at any one time low.
                The 'default-test' execution is the catch-all: it excludes the classes handled by the
                other executions, so any newly added test is picked up automatically.
                -->
                <executions>
                    <execution>
                        <id>default-test</id>
                        <configuration>
                            <excludes>
                                <exclude>%regex[.*DevMcp.*Test.*]</exclude>
                                <exclude>%regex[.*(DevServices|DevUI|ContinuousTesting).*Test.*]</exclude>
                                <exclude>%regex[.*(BuildMetrics|Card|Configuration|ExceptionProcessor).*Test.*]</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>devmcp</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>%regex[.*DevMcp.*Test.*]</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>devui-http</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>%regex[.*(DevServices|DevUI|ContinuousTesting).*Test.*]</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>cards-config</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>%regex[.*(BuildMetrics|Card|Configuration|ExceptionProcessor).*Test.*]</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <configuration>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>io.quarkus</groupId>
                                    <artifactId>quarkus-extension-processor</artifactId>
                                    <version>${project.version}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
