<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>bank.concordia</groupId>
    <artifactId>concordia-portal</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>Concordia Portal</name>
    <description>
        Minimale Jakarta-EE-Webanwendung, die als Vehikel fuer die WAS-Administrationsthemen aus
        der Stellenanzeige dient (Liberty-Betrieb, Security-Lifecycle, Monitoring/Tuning) - siehe
        docs/00-ueberblick/systemlandschaft.md. Kein fachlicher Anspruch, bewusst duenn gehalten.
    </description>

    <properties>
        <maven.compiler.release>21</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>6.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.14.4</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>concordia-portal</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.4.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.4</version>
            </plugin>
        </plugins>

        <!-- Bewusst NICHT im Default-Build aktiv, gleiches Muster wie im Referenzprojekt
             labs/novaris-versicherung-legacy (novaris-policy-ear/pom.xml): liberty:start
             laedt/startet einen echten Server-Prozess und soll den schnellen `mvn package`-
             Kreislauf nicht verlangsamen. Explizit ausfuehren mit: mvn verify -Pliberty-verify
             Siehe docs/10-installation-konfiguration/02-liberty-serverstart-verifiziert.md. -->
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>io.openliberty.tools</groupId>
                    <artifactId>liberty-maven-plugin</artifactId>
                    <version>3.10.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <!-- Standardprofil fuer den interaktiven Admin-Alltag: `mvn liberty:dev` bzw.
             `mvn liberty:run` gegen server.xml (Dev-Variante). Bleibt im Vordergrund,
             zum Beenden Strg+C. -->
        <profile>
            <id>liberty</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.openliberty.tools</groupId>
                        <artifactId>liberty-maven-plugin</artifactId>
                        <configuration>
                            <serverName>concordiaPortalServer</serverName>
                            <runtimeArtifact>
                                <groupId>io.openliberty</groupId>
                                <artifactId>openliberty-runtime</artifactId>
                                <version>[24.0,)</version>
                                <type>zip</type>
                            </runtimeArtifact>
                            <deployPackages>project</deployPackages>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Nicht-interaktives Verifikationsprofil (CI/Nachweis): startet den Server, wartet auf
             CWWKF0011I, stoppt ihn danach automatisch wieder - kein manuelles Strg+C noetig.
             Muster 1:1 aus novaris-policy-ear/pom.xml (dortiger Kommentar erklaert, warum
             deployPackages=project statt looseApplication verwendet wird). -->
        <profile>
            <id>liberty-verify</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.openliberty.tools</groupId>
                        <artifactId>liberty-maven-plugin</artifactId>
                        <configuration>
                            <serverName>concordiaPortalServer</serverName>
                            <runtimeArtifact>
                                <groupId>io.openliberty</groupId>
                                <artifactId>openliberty-runtime</artifactId>
                                <version>[24.0,)</version>
                                <type>zip</type>
                            </runtimeArtifact>
                            <deployPackages>project</deployPackages>
                            <verifyTimeout>180</verifyTimeout>
                            <appsDirectory>apps</appsDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>liberty-start</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>create</goal>
                                    <goal>deploy</goal>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>liberty-stop</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
