<?xml version="1.0"?>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>pro.javacard</groupId>
    <version>26.06.29</version>
    <artifactId>beefy-parent</artifactId>
    <packaging>pom</packaging>
    <name>BeefyJar</name>
    <url>https://github.com/martinpaljak/BeefyJar</url>
    <description>Self-contained Java application distribution</description>
    <inceptionYear>2025</inceptionYear>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <!-- GH Actions fails sometimes on first try -->
        <maven.wagon.http.retryHandler.count>2</maven.wagon.http.retryHandler.count>
        <project.build.outputTimestamp>2026-06-29T08:34:41Z</project.build.outputTimestamp>
        <!-- Plugin integration tests are slow; skipped during local builds, re-enabled in CI
             (check profile) or manually with -Dinvoker.skip=false. -->
        <invoker.skip>true</invoker.skip>
    </properties>
    <organization>
        <name>Martin Paljak and contributors</name>
        <url>https://javacard.pro/</url>
    </organization>
    <licenses>
        <license>
            <name>MIT</name>
            <url>https://github.com/martinpaljak/BeefyJar/blob/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/martinpaljak/BeefyJar</url>
        <developerConnection>scm:git:git@github.com:martinpaljak/beefyjar.git</developerConnection>
    </scm>
    <!-- Always pick up private deps -->
    <repositories>
        <repository>
            <id>javacard-pro</id>
            <url>https://mvn.javacard.pro/maven/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>javacard-pro-snapshots</id>
            <url>https://mvn.javacard.pro/maven/SNAPSHOTS/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <modules>
        <module>beefy-common</module>
        <module>beefy-sshsig-jar</module>
        <module>beefy-source-jar</module>
        <module>beefy-maven-jar</module>
        <module>plugin</module>
        <module>tool</module>
    </modules>
    <build>
        <defaultGoal>clean verify</defaultGoal>
        <plugins>
            <!-- Minimum Maven version. Not really relevant with wrapper -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.6.3</version>
                <executions>
                    <execution>
                        <id>enforce-maven-version</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[21,)</version>
                                    <message>Project requires JDK 21+</message>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>[3.9.16,)</version>
                                </requireMavenVersion>
                                <requirePluginVersions>
                                    <!-- Allow the self-applied beefy-maven-plugin at the reactor SNAPSHOT version -->
                                    <banSnapshots>false</banSnapshots>
                                </requirePluginVersions>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.15.0</version>
                <configuration>
                    <release>21</release>
                    <compilerArgs>
                        <arg>-Werror</arg>
                        <arg>-Xlint:all</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>4.10.2.0</version>
                <executions>
                    <execution>
                        <id>parent-spotbugs</id>
                        <phase>test</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Style gate: dryRun fails the build on pending recipe changes; run -Pfixup to apply.
                 Bound at test, past the process-test-classes phase the goal forks to, so a -Pfixup
                 run applies first and this gate then sees a clean tree. Recipes in pluginManagement. -->
            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>rewrite-check</id>
                        <phase>test</phase>
                        <goals>
                            <goal>dryRun</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!-- Pin default lifecycle plugins so requirePluginVersions has explicit versions -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.4.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.12.1</version>
                </plugin>
                <plugin>
                    <groupId>org.openrewrite.maven</groupId>
                    <artifactId>rewrite-maven-plugin</artifactId>
                    <version>6.42.0</version>
                    <configuration>
                        <activeRecipes>
                            <recipe>org.openrewrite.staticanalysis.NeedBraces</recipe>
                            <recipe>org.openrewrite.staticanalysis.EmptyBlock</recipe>
                            <recipe>org.openrewrite.staticanalysis.FallThrough</recipe>
                            <recipe>org.openrewrite.staticanalysis.DefaultComesLast</recipe>
                            <recipe>org.openrewrite.staticanalysis.EqualsAvoidsNull</recipe>
                            <recipe>org.openrewrite.staticanalysis.ModifierOrder</recipe>
                            <recipe>org.openrewrite.staticanalysis.FinalClass</recipe>
                            <recipe>org.openrewrite.staticanalysis.RemoveExtraSemicolons</recipe>
                            <recipe>org.openrewrite.staticanalysis.UnnecessaryParentheses</recipe>
                            <recipe>org.openrewrite.staticanalysis.UseDiamondOperator</recipe>
                            <recipe>org.openrewrite.staticanalysis.InstanceOfPatternMatch</recipe>
                            <recipe>org.openrewrite.staticanalysis.MissingOverrideAnnotation</recipe>
                            <recipe>org.openrewrite.java.migrate.lang.UseVar</recipe>
                            <recipe>org.openrewrite.java.migrate.lang.StringFormatted</recipe>
                            <recipe>org.openrewrite.java.RemoveUnusedImports</recipe>
                            <recipe>org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods</recipe>
                            <recipe>org.openrewrite.staticanalysis.RemoveUnusedPrivateFields</recipe>
                            <recipe>org.openrewrite.staticanalysis.SimplifyBooleanReturn</recipe>
                            <recipe>org.openrewrite.staticanalysis.LambdaBlockToExpression</recipe>
                            <recipe>org.openrewrite.staticanalysis.UnnecessaryExplicitTypeArguments</recipe>
                            <recipe>org.openrewrite.staticanalysis.CatchClauseOnlyRethrows</recipe>
                        </activeRecipes>
                        <failOnDryRunResults>true</failOnDryRunResults>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.openrewrite.recipe</groupId>
                            <artifactId>rewrite-static-analysis</artifactId>
                            <version>2.37.0</version>
                        </dependency>
                        <dependency>
                            <groupId>org.openrewrite.recipe</groupId>
                            <artifactId>rewrite-migrate-java</artifactId>
                            <version>3.38.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>fixup</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.openrewrite.maven</groupId>
                        <artifactId>rewrite-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>rewrite-fixup</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>check</id>
            <activation>
                <jdk>[21,)</jdk>
                <property>
                    <name>env.CI</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <invoker.skip>false</invoker.skip>
            </properties>
        </profile>
    </profiles>
</project>
