<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>4.0.7</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>org.alexmond</groupId>
    <artifactId>jhelm-parent</artifactId>
    <version>1.5.0</version>
    <packaging>pom</packaging>
    <name>jhelm-parent</name>
    <description>jhelm parent POM</description>
    <url>https://www.alexmond.org/jhelm/current/index.html</url>


    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/alexmond/jhelm/issues</url>
    </issueManagement>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Alex Mondshain</name>
            <email>alex.mondshain@gmail.com</email>
        </developer>
    </developers>

    <properties>
        <!-- JUnit tags excluded by default. The full chart-parity suite (`comparison`)
             fetches and renders every chart in charts.csv against `helm template`; it is
             slow + network-bound, so it is excluded from the normal build and runs in a
             dedicated CI job (see .github/workflows/parity.yml). Override with
             -Dsurefire.excludedGroups= -Dgroups=comparison to run only the parity suite. -->
        <surefire.excludedGroups>comparison</surefire.excludedGroups>
        <!-- Max heap for the test fork. Default 512 MB suits the normal (unit-test) build.
             The chart-parity suite renders + diffs every chart (large manifests through
             SnakeYAML), so the parity CI job overrides this (-Djhelm.test.maxHeap=4g). -->
        <jhelm.test.maxHeap>512m</jhelm.test.maxHeap>
        <gotmpl4j.version>1.3.0</gotmpl4j.version>
        <kubernetes-client.version>26.0.0</kubernetes-client.version>
        <fabric8-client.version>6.13.5</fabric8-client.version>
        <picocli.version>4.7.7</picocli.version>
        <semver4j.version>6.0.0</semver4j.version>
        <!--
            jhelm-core and jhelm-gotemplate-helm call CoreScalarResolver(boolean), added in
            snakeyaml-engine 3.x. Spring Boot's BOM does not manage snakeyaml-engine (only
            classic org.yaml:snakeyaml), and it arrives transitively via jackson-dataformat-yaml,
            so pin a floor here or a downstream graph can resolve an older 2.x → runtime
            NoSuchMethodError on the first chart load (#770).
        -->
        <snakeyaml-engine.version>3.0.1</snakeyaml-engine.version>
        <bouncycastle.version>1.84</bouncycastle.version>
        <!-- Only the config-server sample uses Spring Cloud; 2025.1.x (Oakwood) targets Boot 4.0. -->
        <spring-cloud.version>2025.1.2</spring-cloud.version>
        <commons-compress.version>1.28.0</commons-compress.version>
        <chicory.version>1.7.5</chicory.version>
        <swagger-annotations.version>2.2.52</swagger-annotations.version>
        <springdoc-openapi.version>3.0.3</springdoc-openapi.version>
        <spring-ai.version>2.0.0</spring-ai.version>

        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>

        <jacoco-maven-plugin.version>0.8.14</jacoco-maven-plugin.version>
        <maven-pmd-plugin.version>3.28.0</maven-pmd-plugin.version>
        <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
        <spring-javaformat.version>0.0.47</spring-javaformat.version>
        <checkstyle.version>9.3</checkstyle.version>

        <java.version>21</java.version>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
    </properties>
    <scm>
        <connection>scm:git:git@github.com:alexmond/jhelm.git</connection>
        <developerConnection>scm:git:git@github.com:alexmond/jhelm.git</developerConnection>
        <tag>HEAD</tag>
        <url>https://github.com/alexmond/jhelm</url>
    </scm>
    <modules>
        <module>jhelm-plugin-api</module>
        <module>jhelm-gotemplate-helm</module>
        <module>jhelm-core</module>
        <module>jhelm-kube</module>
        <module>jhelm-rest</module>
        <module>jhelm-rest-starter</module>
        <module>jhelm-mcp</module>
        <module>jhelm-mcp-starter</module>
        <module>jhelm-plugin</module>
        <module>jhelm-cli</module>
        <module>jhelm-samples</module>
        <module>jhelm-benchmarks</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <!-- Picocli -->
            <dependency>
                <groupId>info.picocli</groupId>
                <artifactId>picocli-spring-boot-starter</artifactId>
                <version>${picocli.version}</version>
            </dependency>
            <!-- gotmpl4j: the Go template engine + Sprig functions, now an external
                 library published to Maven Central (extracted from this repo; see
                 https://github.com/alexmond/gotmpl4j). -->
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>gotmpl4j-core</artifactId>
                <version>${gotmpl4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>gotmpl4j-sprig</artifactId>
                <version>${gotmpl4j.version}</version>
            </dependency>
            <!-- Internal Modules -->
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-plugin-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-gotemplate-helm</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-kube</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-rest</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-rest-starter</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-mcp</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-mcp-starter</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm</artifactId>
                <version>${project.version}</version>
            </dependency>
            <!-- Spring AI BOM: manages spring-ai-* artifacts (MCP server) for jhelm-mcp. -->
            <dependency>
                <groupId>org.springframework.ai</groupId>
                <artifactId>spring-ai-bom</artifactId>
                <version>${spring-ai.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- External Dependencies -->
            <dependency>
                <groupId>io.kubernetes</groupId>
                <artifactId>client-java</artifactId>
                <version>${kubernetes-client.version}</version>
            </dependency>
            <!-- Alternative Kubernetes backend; the BOM keeps its transitive versions consistent. -->
            <dependency>
                <groupId>io.fabric8</groupId>
                <artifactId>kubernetes-client-bom</artifactId>
                <version>${fabric8-client.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.semver4j</groupId>
                <artifactId>semver4j</artifactId>
                <version>${semver4j.version}</version>
            </dependency>
            <!-- Explicit floor; see the snakeyaml-engine.version note above (#770). -->
            <dependency>
                <groupId>org.snakeyaml</groupId>
                <artifactId>snakeyaml-engine</artifactId>
                <version>${snakeyaml-engine.version}</version>
            </dependency>
            <dependency>
                <groupId>org.alexmond</groupId>
                <artifactId>jhelm-plugin</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.dylibso.chicory</groupId>
                <artifactId>runtime</artifactId>
                <version>${chicory.version}</version>
            </dependency>
            <dependency>
                <groupId>com.dylibso.chicory</groupId>
                <artifactId>wasi</artifactId>
                <version>${chicory.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-compress</artifactId>
                <version>${commons-compress.version}</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk18on</artifactId>
                <version>${bouncycastle.version}</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpg-jdk18on</artifactId>
                <version>${bouncycastle.version}</version>
            </dependency>
            <dependency>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>${swagger-annotations.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springdoc</groupId>
                <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
                <version>${springdoc-openapi.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>


    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>io.github.git-commit-id</groupId>
                    <artifactId>git-commit-id-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <goals>
                                <goal>revision</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <verbose>true</verbose>
                        <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
                        <generateGitPropertiesFile>true</generateGitPropertiesFile>
                        <generateGitPropertiesFilename>
                            ${project.build.outputDirectory}/git.properties
                        </generateGitPropertiesFilename>
                        <skipPoms>false</skipPoms>
                        <useNativeGit>true</useNativeGit>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!-- Generate JavaDoc JAR -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <!-- Enforce clean published Javadoc: broken @links, malformed
                             HTML, and doc syntax errors fail the build. Lombok-generated
                             accessors are invisible to doclint, so link the declaring type
                             rather than a generated getter. -->
                        <doclint>reference,html,syntax</doclint>
                        <failOnError>true</failOnError>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- GPG signing -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                            <configuration>
                                <!-- Prevent gpg from using pinentry -->
                                <gpgArguments>
                                    <arg>--pinentry-mode</arg>
                                    <arg>loopback</arg>
                                </gpgArguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${central-publishing-maven-plugin.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <publishingServerId>central</publishingServerId>
                        <autoPublish>true</autoPublish>
                        <waitUntil>published</waitUntil>
                        <!-- The sample/demo modules and the CLI are apps, not libraries —
                             keep them out of the Central bundle. central-publishing ignores
                             maven.deploy.skip, so excludeArtifacts on the aggregator config
                             is the safe lever (drops just these artifactIds). The CLI
                             (artifactId 'jhelm') is a Spring Boot fat jar with javadoc
                             skipped, so Central would reject it for a missing -javadoc.jar
                             and abort the whole publish. (#560) -->
                        <excludeArtifacts>
                            <excludeArtifact>jhelm</excludeArtifact>
                            <excludeArtifact>jhelm-samples</excludeArtifact>
                            <excludeArtifact>jhelm-sample</excludeArtifact>
                            <excludeArtifact>jhelm-rest-sample</excludeArtifact>
                            <excludeArtifact>jhelm-mcp-sample</excludeArtifact>
                            <excludeArtifact>jhelm-config-server-sample</excludeArtifact>
                            <excludeArtifact>jhelm-plugin-api-sample</excludeArtifact>
                            <excludeArtifact>jhelm-benchmarks</excludeArtifact>
                        </excludeArtifacts>
                    </configuration>
                </plugin>
                <!-- Generate JavaDoc JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings> <!-- Optional: also show all other warnings -->
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Use late property evaluation for JaCoCo integration -->
                    <argLine>@{argLine} -Xmx${jhelm.test.maxHeap} -XX:MaxMetaspaceSize=256m</argLine>
                    <forkCount>1</forkCount>
                    <reuseForks>true</reuseForks>
                    <!-- The heavy chart-parity suite is tagged `comparison` and excluded
                         here; it runs in the dedicated parity CI job. -->
                    <excludedGroups>${surefire.excludedGroups}</excludedGroups>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <formats>
                                <format>XML</format>
                                <format>HTML</format>
                            </formats>
                        </configuration>
                    </execution>
                    <execution>
                        <id>check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.75</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.spring.javaformat</groupId>
                <artifactId>spring-javaformat-maven-plugin</artifactId>
                <version>${spring-javaformat.version}</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>validate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${maven-pmd-plugin.version}</version>
                <configuration>
                    <targetJdk>${java.version}</targetJdk>
                    <linkXRef>false</linkXRef>
                    <failOnViolation>true</failOnViolation>
                    <printFailingErrors>true</printFailingErrors>
                    <includeTests>false</includeTests>
                    <rulesets>
                        <ruleset>pmd-ruleset.xml</ruleset>
                    </rulesets>
                </configuration>
                <executions>
                    <execution>
                        <id>pmd-check</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>io.spring.javaformat</groupId>
                        <artifactId>spring-javaformat-checkstyle</artifactId>
                        <version>${spring-javaformat.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${checkstyle.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>checkstyle-validation</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <configLocation>checkstyle.xml</configLocation>
                            <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>io.spring.javaformat</groupId>
                <artifactId>spring-javaformat-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <!-- Run Javadoc (with doclint enforcement, see pluginManagement) on every
                 build so broken references / HTML / syntax fail PR CI, not just release.
                 Skipped for the non-published cli + sample modules. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>io.github.git-commit-id</groupId>
                        <artifactId>git-commit-id-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
