<?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>eu.vnagy.argotools</groupId>
    <artifactId>argo-junit</artifactId>
    <version>0.0.7</version>

    <name>Argo JUnit</name>
    <description>A JUnit 5 library that executes Argo Workflows locally against real containers, without a Kubernetes cluster. Write tests that run your actual workflows and assert on their outcomes, step outputs, and artifacts.</description>
    <url>https://github.com/vilmosnagy/argo-junit</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/vilmosnagy/argo-junit</url>
        <connection>scm:git:git@github.com:vilmosnagy/argo-junit.git</connection>
        <tag>HEAD</tag>
    </scm>

    <developers>
        <developer>
            <name>Vilmos Szabó-Nagy</name>
            <email>me@vnagy.eu</email>
            <url>https://vnagy.eu</url>
        </developer>
    </developers>

    <properties>
        <maven.compiler.source>25</maven.compiler.source>
        <maven.compiler.target>25</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jackson.version>2.22.0</jackson.version>
        <argo.quickstart.version>v4.0.5</argo.quickstart.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</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>org.openapitools</groupId>
            <artifactId>jackson-databind-nullable</artifactId>
            <version>0.2.6</version>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>3.0.2</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.17</version>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <version>2.0.5</version>
        </dependency>
        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-client</artifactId>
            <version>7.3.0</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>s3</artifactId>
            <version>2.29.51</version>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>url-connection-client</artifactId>
            <version>2.46.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>1.28.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-jexl3</artifactId>
            <version>3.3</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.5.34</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.11.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>3.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!--
                Strip well-known package prefixes from the Argo swagger spec so that
                openapi-generator produces clean class names:
                  io.k8s.api.core.v1.Container              -> Container
                  io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta -> ObjectMeta
                  io.argoproj.workflow.v1alpha1.Workflow     -> Workflow
                Types from other namespaces (argo-events, sensor, …) keep their
                verbose prefix-derived names and are generated but largely unused.
            -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.6.3</version>
                <executions>
                    <execution>
                        <id>preprocess-swagger</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>sh</executable>
                            <arguments>
                                <argument>-c</argument>
                                <argument>mkdir -p "${project.build.directory}" &amp;&amp; sed 's/io\.argoproj\.workflow\.v1alpha1\.//g' "${basedir}/argo-workflows/api/openapi-spec/swagger.json" > "${project.build.directory}/argo-swagger.json"</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>7.22.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.build.directory}/argo-swagger.json</inputSpec>
                            <generatorName>java</generatorName>
                            <modelPackage>eu.vnagy.argotools.junit.model</modelPackage>
                            <apiPackage>eu.vnagy.argotools.junit.generated.api</apiPackage>
                            <invokerPackage>eu.vnagy.argotools.junit.generated</invokerPackage>
                            <generateApis>false</generateApis>
                            <generateModelTests>false</generateModelTests>
                            <generateModelDocumentation>false</generateModelDocumentation>
                            <skipValidateSpec>true</skipValidateSpec>
                            <globalProperties>
                                <generateAliasAsModel>true</generateAliasAsModel>
                            </globalProperties>
                            <configOptions>
                                <library>native</library>
                                <serializationLibrary>jackson</serializationLibrary>
                                <hideGenerationTimestamp>true</hideGenerationTimestamp>
                                <dateLibrary>java8</dateLibrary>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.6</version>
            </plugin>

            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <version>1.9.0</version>
                <executions>
                    <execution>
                        <id>download-argo-quick-start</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://github.com/argoproj/argo-workflows/releases/download/${argo.quickstart.version}/quick-start-minimal.yaml</url>
                            <outputDirectory>${project.build.outputDirectory}/argo-install</outputDirectory>
                            <outputFileName>quick-start-minimal.yaml</outputFileName>
                            <!--
                                overwrite=true ensures the file is always copied from the local cache
                                (~/.m2/repository/.cache/download-maven-plugin/) to target/classes.
                                When argo.quickstart.version changes, the URL changes, a new cache entry
                                is created, and the updated file lands in target/. Network traffic only
                                happens on the first build after a version bump.
                            -->
                            <overwrite>true</overwrite>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>2.7.1</version>
                <executions>
                    <execution>
                        <id>update-project-license</id>
                        <goals>
                            <goal>update-project-license</goal>
                        </goals>
                        <configuration>
                            <inceptionYear>2026</inceptionYear>
                            <licenseName>apache_v2</licenseName>
                            <organizationName>Vilmos Szabó-Nagy</organizationName>
                            <projectName>Argo JUnit</projectName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>update-file-header</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>update-file-header</goal>
                        </goals>
                        <configuration>
                            <inceptionYear>2026</inceptionYear>
                            <licenseName>apache_v2</licenseName>
                            <organizationName>Vilmos Szabó-Nagy</organizationName>
                            <projectName>Argo JUnit</projectName>
                            <excludes>
                                <exclude>**/resources/examples/*</exclude>
                                <exclude>**/resources/examples/**/*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.15</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <!-- attached to Maven test phase -->
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>eu/vnagy/argotools/junit/model/*</excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.12.0</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <excludePackageNames>eu.vnagy.argotools.junit.model</excludePackageNames>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-gpg-plugin</artifactId>
                            <version>3.2.8</version>
                            <configuration>
                                <keyname>A12E04CFAB41C6364B283C947EF4B301779D73B3</keyname>
                                <gpgArguments>
                                    <arg>--pinentry-mode</arg>
                                    <arg>loopback</arg>
                                </gpgArguments>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>sign-artifacts</id>
                                    <phase>verify</phase>
                                    <goals>
                                        <goal>sign</goal>
                                    </goals>
                                </execution>
                            </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.10.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitUntil>uploaded</waitUntil>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
