<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <groupId>com.github.martinpaljak</groupId>
    <artifactId>ant-javacard-package</artifactId>
    <version>26.05.15</version>
    <description>Easy to use Ant task for building JavaCard applets</description>
    <name>ant-javacard package</name>
    <url>https://github.com/martinpaljak/ant-javacard</url>
    <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-05-15T11:55:26Z</project.build.outputTimestamp>
    </properties>
    <repositories>
        <repository>
            <id>javacard-pro</id>
            <name>javacard.pro</name>
            <url>https://mvn.javacard.pro/maven/</url>
        </repository>
        <repository>
            <id>javacard-pro-snapshots</id>
            <url>https://mvn.javacard.pro/maven/SNAPSHOTS/</url>
        </repository>
    </repositories>
    <!-- Default is publishing to private Maven repo on javacard.pro -->
    <distributionManagement>
        <repository>
            <id>javacard</id>
            <url>scpexe://mvn@mvn.javacard.pro/home/mvn/maven/</url>
        </repository>
        <snapshotRepository>
            <id>javacard</id>
            <url>scpexe://mvn@mvn.javacard.pro/home/mvn/maven/SNAPSHOTS</url>
        </snapshotRepository>
    </distributionManagement>
    <modules>
        <module>capfile</module>
        <module>task</module>
    </modules>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.openrewrite.maven</groupId>
                    <artifactId>rewrite-maven-plugin</artifactId>
                    <version>6.39.0</version>
                    <configuration>
                        <runPerSubmodule>true</runPerSubmodule>
                        <activeRecipes>
                            <!-- Braces everywhere -->
                            <recipe>org.openrewrite.staticanalysis.NeedBraces</recipe>
                            <!-- Standard modifier ordering -->
                            <recipe>org.openrewrite.staticanalysis.ModifierOrder</recipe>
                            <!-- Final everywhere -->
                            <recipe>org.openrewrite.staticanalysis.FinalizePrivateFields</recipe>
                        </activeRecipes>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.openrewrite.recipe</groupId>
                            <artifactId>rewrite-static-analysis</artifactId>
                            <version>2.34.1</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>4.9.8.3</version>
                    <configuration>
                        <excludeFilterFile>spotbugs.xml</excludeFilterFile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.14</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh-external</artifactId>
                <version>3.5.3</version>
            </extension>
        </extensions>
        <plugins>
            <!-- Minimum Maven version. Not really relevant with wrapper -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.6.2</version>
                <executions>
                    <execution>
                        <id>enforce-maven-version</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[11,)</version>
                                    <message>Project requires JDK 11+</message>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>[3.9.15,)</version>
                                </requireMavenVersion>
                                <requirePluginVersions/>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Compiler -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.15.0</version>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <configuration>
                            <!-- compile everything to ensure module-info contains right entries -->
                            <release>11</release>
                            <compilerArgs combine.children="append">
                                <arg>-Werror</arg>
                                <arg>-Xlint:all</arg>
                                <arg>-Xlint:-options</arg>
                            </compilerArgs>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- Run tests with 11 -->
                        <id>default-testCompile</id>
                        <configuration>
                            <!-- compile everything to ensure module-info contains right entries -->
                            <release>11</release>
                        </configuration>
                    </execution>
                    <execution>
                        <id>base-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <!-- recompile everything for 1.8 except the module-info.java -->
                        <configuration>
                            <source>8</source>
                            <target>8</target>
                            <excludes>
                                <exclude>module-info.java</exclude>
                            </excludes>
                            <compilerArgs combine.children="append">
                                <arg>-Xlint:-options</arg>
                            </compilerArgs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.2.0</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>ant-dist</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <!-- Pass the plugin classpath to antrun, which is normally not there -->
                                <property name="maven.plugin.classpath" refid="maven.plugin.classpath"/>
                                <ant antfile="build.xml" target="dist" inheritAll="true"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Version fixes -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.5.0</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.21.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.5</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-resources-plugin</artifactId>
                <version>3.5.0</version>
            </plugin>
        </plugins>
    </build>

    <!-- Metadata -->
    <licenses>
        <license>
            <name>MIT</name>
            <url>https://github.com/martinpaljak/ant-javacard/blob/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/martinpaljak/ant-javacard</url>
    </scm>
    <profiles>
        <profile>
            <id>check</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.openrewrite.maven</groupId>
                        <artifactId>rewrite-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>dryRun</goal>
                                </goals>
                                <configuration>
                                    <failOnDryRunResults>true</failOnDryRunResults>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>fixup</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.openrewrite.maven</groupId>
                        <artifactId>rewrite-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
