<?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>

    <artifactId>migration-runner</artifactId>
    <name>${project.artifactId}</name>
    <description>Orchestrates and executes declared migrations, coordinating steps defined in DSL or YAML configurations</description>
    <url>https://documentation.noumenadigital.com/</url>

    <licenses>
        <license>
            <name>NPL Maven Plugin License</name>
            <url>https://noumenadigital.com/npl-maven-plugin-license/</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <organization>Noumena Digital</organization>
            <organizationUrl>https://noumenadigital.com/</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/NoumenaDigital/platform</url>
    </scm>

    <parent>
        <groupId>com.noumenadigital.platform</groupId>
        <artifactId>parent-pom</artifactId>
        <version>2025.2.2</version>
        <relativePath>../parent-pom</relativePath>
    </parent>

    <properties>
        <skipDetekt>true</skipDetekt>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>migration-dsl</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-scripting-jsr223</artifactId>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
            </plugin>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <skip>${skipITs}</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <configuration>
                    <skip>${skipITs}</skip> <!-- Don't exec all the docker compose steps if skipping ITs. -->
                    <longModulepath>false</longModulepath>
                </configuration>
                <executions>
                    <!--Pre-IT: Ensure nothing is running-->
                    <!--Pre-IT: Build and Launch the required services-->
                    <execution>
                        <id>docker-compose-up</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>./docker-scripts</executable>
                            <arguments>
                                <argument>start_db_it_containers</argument>
                            </arguments>
                            <skip>${skipITs}</skip>
                        </configuration>
                    </execution>
                    <!--Post-IT: archive all the log output. -->
                    <!--Post-IT: Teardown-->
                    <execution>
                        <id>docker-archive-logs-and-teardown</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>./docker-scripts</executable>
                            <arguments>
                                <argument>cleanup</argument>
                            </arguments>
                            <outputFile>docker-compose.log</outputFile>
                            <skip>${skipITs}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
