<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2025-2026 Markus Spann, SpeedBankingDe

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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>de.speedbanking</groupId>
    <artifactId>iban-commons-parent</artifactId>
    <version>1.8.7</version>
    <packaging>pom</packaging>
    <name>${project.organization.name} IBAN Commons Parent</name>
    <description>
        Parent POM for the IBAN Commons multi-module project. Provides shared dependency
        management, plugin configuration, and build conventions for all sub-modules.
    </description>
    <url>https://www.speedbanking.de</url>
    <inceptionYear>2025</inceptionYear>

    <organization>
        <name>SpeedBankingDe</name>
        <url>${project.url}</url>
    </organization>

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

    <developers>
        <developer>
            <id>${developer1Id}</id>
            <name>${developer1Name}</name>
            <email>${developer1Email}</email>
        </developer>
        <developer>
            <id>${developer2Id}</id>
            <name>${developer2Name}</name>
            <email>${developer2Email}</email>
        </developer>
    </developers>

    <modules>
        <module>iban-commons</module>
        <module>iban-commons-junit</module>
    </modules>

    <scm>
        <connection>scm:git:ssh://git@github.com/${project.organization.name}/${project.dist.name}.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/${project.organization.name}/${project.dist.name}.git</developerConnection>
        <url>https://github.com/${project.organization.name}/${project.dist.name}</url>
        <tag>iban-commons-1.8.7</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>${project.url}/issues</url>
    </issueManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>central</id>
            <name>Sonatype Central Snapshots</name>
            <url>${deploy.snapshot.url}</url>
        </snapshotRepository>
        <repository>
            <id>central</id>
            <name>Sonatype Central Staging Repository</name>
            <url>https://central.sonatype.com</url>
        </repository>
    </distributionManagement>

    <properties>
        <javaVersion>8</javaVersion>

        <project.dist.name>iban-commons</project.dist.name>

        <project.copyrightYear>2026</project.copyrightYear>

        <dep.junit.version>5.14.3</dep.junit.version>
        <dep.assertj.version>3.27.7</dep.assertj.version>
        <dep.mockito.version>4.11.0</dep.mockito.version>
        <dep.pitest-junit5-plugin.version>1.2.3</dep.pitest-junit5-plugin.version>

        <developer1Id>spannm</developer1Id>
        <developer1Name>Markus Spann</developer1Name>
        <developer1Email>spannm@outlook.de</developer1Email>

        <developer2Id>spannn</developer2Id>
        <developer2Name>Noah Spann</developer2Name>
        <developer2Email>spannn@outlook.de</developer2Email>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss.SSS</maven.build.timestamp.format>

        <deploy.snapshot.url>https://central.sonatype.com/repository/maven-snapshots/</deploy.snapshot.url>

        <dep.checkstyle.version>12.3.1</dep.checkstyle.version>
        <!-- Path relative to each sub-module; both modules share the same ruleset location -->
        <check.checkstyle.ruleset>${maven.multiModuleProjectDirectory}/src/test/resources/team/checkstyle-rules.xml</check.checkstyle.ruleset>

        <dep.pmd.version>7.24.0</dep.pmd.version>
        <check.pmd.ruleset>${maven.multiModuleProjectDirectory}/src/test/resources/team/pmd-rules.xml</check.pmd.ruleset>

        <!-- Plugin versions (alphabetically) -->
        <dep.plugin.central-publishing.version>0.10.0</dep.plugin.central-publishing.version>
        <dep.plugin.checkstyle.version>3.6.0</dep.plugin.checkstyle.version>
        <dep.plugin.compiler.version>3.15.0</dep.plugin.compiler.version>
        <dep.plugin.cyclonedx.version>2.9.1</dep.plugin.cyclonedx.version>
        <dep.plugin.enforcer.version>3.6.2</dep.plugin.enforcer.version>
        <!-- last error-prone version compatible with Java 17; 2.43.0+ requires Java 21 -->
        <dep.plugin.error-prone.version>2.42.0</dep.plugin.error-prone.version>
        <dep.plugin.error-prone-support.version>0.26.0</dep.plugin.error-prone-support.version>
        <dep.plugin.exec.version>3.6.3</dep.plugin.exec.version>
        <dep.plugin.gpg.version>3.2.8</dep.plugin.gpg.version>
        <dep.plugin.jacoco.version>0.8.14</dep.plugin.jacoco.version>
        <dep.plugin.jar.version>3.5.0</dep.plugin.jar.version>
        <dep.plugin.javadoc.version>3.12.0</dep.plugin.javadoc.version>
        <dep.plugin.license.version>5.0.0</dep.plugin.license.version> <!-- see https://mathieu.carbou.me/license-maven-plugin -->
        <dep.plugin.pitest.version>1.23.1</dep.plugin.pitest.version>
        <dep.plugin.pmd.version>3.28.0</dep.plugin.pmd.version>
        <dep.plugin.release.version>3.3.1</dep.plugin.release.version>
        <dep.plugin.sortpom.version>4.0.0</dep.plugin.sortpom.version> <!-- see https://github.com/Ekryd/sortpom/releases -->
        <dep.plugin.source.version>3.4.0</dep.plugin.source.version>
        <dep.plugin.surefire.version>3.5.5</dep.plugin.surefire.version>
        <dep.plugin.versions.version>2.21.0</dep.plugin.versions.version>

        <sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>

        <surefireArgLine /> <!-- placeholder; overridden by jacoco-prepare-agent -->
    </properties>

    <!--
        Dependency management: versions and default scopes for all dependencies
        used across sub-modules. Sub-modules inherit versions but still must
        declare the dependency explicitly to opt in.
    -->
    <dependencyManagement>
        <dependencies>

            <!-- inter-module dependency: iban-commons-junit depends on iban-commons -->
            <dependency>
                <groupId>de.speedbanking</groupId>
                <artifactId>iban-commons</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>de.speedbanking</groupId>
                <artifactId>iban-commons</artifactId>
                <version>${project.version}</version>
                <type>test-jar</type>
                <classifier>tests</classifier>
            </dependency>

            <!--
                iban-commons-junit as test dependency for iban-commons.
                Using test scope here avoids a circular compile dependency:
                  iban-commons (compile) -> iban-commons-junit (test-only)
                  iban-commons-junit (compile) -> iban-commons
                Maven does not consider test-scoped deps when checking for cycles,
                so the reactor build order (iban-commons first) is unambiguous.
            -->
            <dependency>
                <groupId>de.speedbanking</groupId>
                <artifactId>iban-commons-junit</artifactId>
                <version>${project.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${dep.junit.version}</version>
                <scope>test</scope>
            </dependency>

            <!--
                junit-jupiter-api at compile scope: required by iban-commons-junit
                because its public API (annotations, ArgumentsProvider implementations)
                references JUnit types that consumers need on their compile classpath.
            -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>${dep.junit.version}</version>
            </dependency>

            <!--
                junit-jupiter-params at compile scope: required by iban-commons-junit
                because @ArgumentsSource, ArgumentsProvider, AnnotationConsumer etc.
                are part of the public API of the *Source annotation classes.
            -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-params</artifactId>
                <version>${dep.junit.version}</version>
            </dependency>

            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${dep.assertj.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${dep.mockito.version}</version>
                <scope>test</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>

        <defaultGoal>clean verify</defaultGoal>

        <pluginManagement>

            <plugins>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${dep.plugin.compiler.version}</version>
                    <configuration>
                        <release>${javaVersion}</release>
                        <debug>true</debug>
                        <debuglevel>lines,vars,source</debuglevel>
                        <showWarnings>true</showWarnings>
                        <showDeprecation>true</showDeprecation>
                        <compilerArgument>-Xlint:all,-options</compilerArgument>
                        <parameters>true</parameters>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${dep.plugin.surefire.version}</version>
                    <configuration>
                        <failIfNoTests>true</failIfNoTests>
                        <trimStackTrace>false</trimStackTrace>
                        <printSummary>true</printSummary>
                        <testFailureIgnore>false</testFailureIgnore>

                        <forkCount>2</forkCount>
                        <reuseForks>true</reuseForks>
                        <forkedProcessTimeoutInSeconds>180</forkedProcessTimeoutInSeconds>

                        <argLine>@{surefireArgLine} -XX:+EnableDynamicAgentLoading -Xmx2048m</argLine>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${dep.plugin.jacoco.version}</version>
                    <executions>
                        <execution>
                            <id>jacoco-prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <propertyName>surefireArgLine</propertyName>
                            </configuration>
                        </execution>
                        <execution>
                            <id>jacoco-report</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <formats>
                                    <format>XML</format>
                                    <format>HTML</format>
                                </formats>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${dep.plugin.jar.version}</version>
                    <configuration>
                        <archive>
                            <addMavenDescriptor>false</addMavenDescriptor>
                            <compress>true</compress>
                            <index>false</index>
                            <manifest>
                                <addClasspath>false</addClasspath>
                                <addDefaultEntries>true</addDefaultEntries>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>  <!-- Implementation-Title/Version/Vendor -->
                                <addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
                                <addBuildEnvironmentEntries>true</addBuildEnvironmentEntries>  <!-- Build-Jdk, Build-Os, Build-Tool -->
                            </manifest>

                            <manifestEntries>
                                <Build-Time>${maven.build.timestamp}</Build-Time>
                                <Project-Java-Version>${javaVersion}</Project-Java-Version>
                                <Project-Url>${project.url}</Project-Url>
                                <Project-Inception-Year>${project.inceptionYear}</Project-Inception-Year>
                                <Creation-User>${developer1Id} (${developer1Name}), ${developer2Id} (${developer2Name})</Creation-User>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${dep.plugin.javadoc.version}</version>
                    <configuration>
                        <failOnError>true</failOnError>
                        <release>${javaVersion}</release>
                        <source>${javaVersion}</source>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <maxmemory>1024m</maxmemory>
                        <doclint>all,-missing</doclint>
                        <show>protected</show>
                        <windowtitle>${project.name} ${project.version} API</windowtitle>
                        <doctitle>${project.name} ${project.version} API</doctitle>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- https://pitest.org/
                         mvn compile org.pitest:pitest-maven:mutationCoverage -->
                    <groupId>org.pitest</groupId>
                    <artifactId>pitest-maven</artifactId>
                    <version>${dep.plugin.pitest.version}</version>
                    <configuration>
                        <withHistory>false</withHistory>

                        <useSlf4j>true</useSlf4j>
                        <verbose>true</verbose>
                        <argLine>-Xmx2048m</argLine>

                        <avoidCallsTo>
                            <avoidCallsTo>org.slf4j</avoidCallsTo>
                            <avoidCallsTo>java.util.logging</avoidCallsTo>
                        </avoidCallsTo>

                        <targetClasses>
                            <param>de.speedbanking.*</param>
                        </targetClasses>
                        <targetTests>
                            <param>de.speedbanking.*</param>
                        </targetTests>
                    </configuration>

                    <dependencies>
                        <dependency>
                            <groupId>org.pitest</groupId>
                            <artifactId>pitest-junit5-plugin</artifactId>
                            <version>${dep.pitest-junit5-plugin.version}</version>
                        </dependency>

                        <dependency>
                            <groupId>org.junit.jupiter</groupId>
                            <artifactId>junit-jupiter</artifactId>
                            <version>${dep.junit.version}</version>
                            <scope>runtime</scope>
                        </dependency>
                    </dependencies>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${dep.plugin.checkstyle.version}</version>
                    <configuration>
                        <failOnViolation>true</failOnViolation>
                        <configLocation>${check.checkstyle.ruleset}</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <logViolationsToConsole>true</logViolationsToConsole>
                        <violationSeverity>warning</violationSeverity>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${dep.checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>checkstyle-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <phase>test-compile</phase>
                            <!-- fail before lengthy test execution -->
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <!-- http://maven.apache.org/plugins/maven-pmd-plugin/ -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${dep.plugin.pmd.version}</version>
                    <configuration>
                        <failOnViolation>true</failOnViolation>
                        <printFailingErrors>true</printFailingErrors>
                        <includeTests>true</includeTests>
                        <failurePriority>4</failurePriority>
                        <linkXRef>false</linkXRef>
                        <!-- minimum number of tokens that need to be duplicated before it causes a violation: -->
                        <minimumTokens>50</minimumTokens>
                        <rulesets>
                            <ruleset>${check.pmd.ruleset}</ruleset>
                        </rulesets>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>net.sourceforge.pmd</groupId>
                            <artifactId>pmd-core</artifactId>
                            <version>${dep.pmd.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>net.sourceforge.pmd</groupId>
                            <artifactId>pmd-java</artifactId>
                            <version>${dep.pmd.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>pmd-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <phase>test-compile</phase>
                            <!-- fail before lengthy test execution -->
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <!-- https://mathieu.carbou.me/license-maven-plugin/ -->
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${dep.plugin.license.version}</version>
                    <configuration>
                        <header>com/mycila/maven/plugin/license/templates/APACHE-2-noemail.txt</header>
                        <properties>
                            <year>${project.inceptionYear}-${project.copyrightYear}</year>
                            <owner>${developer1Name}, ${project.organization.name}</owner>
                        </properties>
                        <excludes>
                            <exclude>**/package-info.java</exclude>
                            <exclude>src/test/java/**/*.java</exclude>
                            <exclude>src/test/resources/**</exclude>
                            <exclude>**/*.properties</exclude>
                            <exclude>**/*.txt</exclude>
                        </excludes>
                        <mapping>
                            <java>SLASHSTAR_STYLE</java>
                        </mapping>
                    </configuration>
                    <executions>
                        <execution>
                            <id>license-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <phase>validate</phase>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <!-- mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort -->
                    <groupId>com.github.ekryd.sortpom</groupId>
                    <artifactId>sortpom-maven-plugin</artifactId>
                    <version>${dep.plugin.sortpom.version}</version>
                    <configuration>
                        <createBackupFile>false</createBackupFile>
                        <expandEmptyElements>false</expandEmptyElements>
                        <keepBlankLines>true</keepBlankLines>
                        <lineSeparator>\n</lineSeparator>
                        <nrOfIndentSpace>4</nrOfIndentSpace>
                        <sortModules>false</sortModules>
                        <sortDependencies>none</sortDependencies>
                        <sortProperties>false</sortProperties>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${dep.plugin.enforcer.version}</version>
                    <configuration>
                        <rules>

                            <requireMavenVersion>
                                <version>[3.9.0,)</version>
                            </requireMavenVersion>
                            <requireJavaVersion>
                                <version>[17,)</version>
                            </requireJavaVersion>

                            <requirePluginVersions>
                                <message>Best practice is to always define Maven plugin versions</message>
                                <banTimestamps>true</banTimestamps>

                                <unCheckedPluginList>
                                    org.apache.maven.plugins:maven-clean-plugin,
                                    org.apache.maven.plugins:maven-dependency-plugin,
                                    org.apache.maven.plugins:maven-deploy-plugin,
                                    org.apache.maven.plugins:maven-install-plugin,
                                    org.apache.maven.plugins:maven-resources-plugin,
                                    org.apache.maven.plugins:maven-site-plugin
                                </unCheckedPluginList>
                            </requirePluginVersions>
                        </rules>
                    </configuration>
                    <executions>
                        <execution>
                            <id>default-enforce</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <phase>validate</phase>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <!-- CycloneDX Maven Plugin
                         https://cyclonedx.github.io/cyclonedx-maven-plugin -->
                    <groupId>org.cyclonedx</groupId>
                    <artifactId>cyclonedx-maven-plugin</artifactId>
                    <version>${dep.plugin.cyclonedx.version}</version>
                    <configuration>
                        <projectType>library</projectType>
                        <skipNotDeployed>false</skipNotDeployed>
                        <outputFormat>xml</outputFormat>
                        <outputName>sbom</outputName>
                        <verbose>false</verbose>
                    </configuration>
                    <executions>
                        <execution>
                            <id>cyclonedx-makebom</id>
                            <goals>
                                <goal>makeBom</goal>
                            </goals>
                            <phase>package</phase>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${dep.plugin.release.version}</version>
                    <configuration>
                        <tagNameFormat>${project.dist.name}-@{project.version}</tagNameFormat>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <pushChanges>false</pushChanges>
                        <localCheckout>true</localCheckout>
                        <preparationGoals>clean install</preparationGoals>
                        <useReleaseProfile>false</useReleaseProfile>
                        <goals>deploy</goals>
                        <releaseProfiles>release</releaseProfiles>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- https://www.mojohaus.org/exec-maven-plugin/
                         e.g. mvn exec:exec@update-docs-version -DreleaseVersion=1.8.6 -->
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${dep.plugin.exec.version}</version>
                    <executions>
                        <execution>
                            <id>update-docs-version</id>
                            <phase>none</phase> <!-- only manual execution -->
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>bash</executable>
                                <arguments>
                                    <!-- script lives in the root (parent) module -->
                                    <argument>${maven.multiModuleProjectDirectory}/src/main/scripts/update-docs-version.sh</argument>
                                    <argument>${project.dist.name}</argument>
                                    <argument>${releaseVersion}</argument>
                                </arguments>
                                <workingDirectory>${maven.multiModuleProjectDirectory}</workingDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${dep.plugin.versions.version}</version>
                    <configuration>
                        <ruleSet>
                            <ignoreVersions>
                                <ignoreVersion>
                                    <type>regex</type>
                                    <version>.*(?i)(alpha|beta|rc|cr|preview|milestone|[mb][0-9]+).*</version>
                                </ignoreVersion>
                            </ignoreVersions>
                        </ruleSet>
                    </configuration>
                </plugin>

            </plugins>

        </pluginManagement>

        <!--
            Plugins active for ALL sub-modules.
            Plugins that are sub-module-specific (e.g. exec, cyclonedx) are activated
            only in the respective sub-module POM.
        -->
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
            </plugin>

            <!-- Sources are attached here for the default build -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${dep.plugin.source.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>

        </plugins>

    </build>

    <profiles>

        <!-- profile to fail the build on Error Prone findings, active by default.
             To disable: mvn clean compile -D check.skip-errorprone=true
             see: https://errorprone.info/ -->
        <profile>
            <id>errorprone-fatal</id>
            <activation>
                <property>
                    <name>!check.skip-errorprone</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <fork>true</fork>
                            <compilerArgs combine.children="append">
                                <arg>-Werror</arg>
                                <arg>-XDcompilePolicy=simple</arg>
                                <arg>-XDaddTypeAnnotationsToSymbol=true</arg>

                                <arg>--should-stop=ifError=FLOW</arg>

                                <arg>-Xplugin:ErrorProne -Xep:MissingSummary:WARN -Xep:InvalidBlockTag:WARN -Xep:CanonicalAnnotationSyntax:OFF -Xep:LexicographicalAnnotationAttributeListing:OFF -Xep:LexicographicalAnnotationListing:OFF</arg>

                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
                            </compilerArgs>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>com.google.errorprone</groupId>
                                    <artifactId>error_prone_core</artifactId>
                                    <version>${dep.plugin.error-prone.version}</version>
                                </path>
                                <!-- Error Prone Support's additional bug checkers -->
                                <path>
                                    <groupId>tech.picnic.error-prone-support</groupId>
                                    <artifactId>error-prone-contrib</artifactId>
                                    <version>${dep.plugin.error-prone-support.version}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- Activated for release:prepare and release:perform goals -->
            <id>release</id>

            <properties>
                <!-- Tests have already been run in the release:prepare step; skip here
                     to avoid re-running them during release:perform
                     Note: failIfNoTests in Surefire has no effect when skipTests=true
                     because Surefire does not execute at all -->
                <skipTests>true</skipTests>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${dep.plugin.javadoc.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Sign artifacts using gpg for oss upload
                         Binds by default to the lifecycle phase: verify
                         https://maven.apache.org/plugins/maven-gpg-plugin/ -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${dep.plugin.gpg.version}</version>
                        <configuration>
                            <useAgent>true</useAgent>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <!-- central-publishing-maven-plugin is the official tool for publishing artifacts to the new Sonatype Central Portal
                             https://central.sonatype.org/publish/publish-portal-maven -->
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${dep.plugin.central-publishing.version}</version>

                        <!-- The <extensions>true</extensions> attribute tells Maven to include the plugin's code in the build lifecycle,
                             allowing it to hook into specific phases and extend Maven's default behavior.
                             This lets the plugin take over the standard deploy goal and implement its own logic for deploying to the new Sonatype Central Portal. -->
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <!-- do not automatically release staged artifacts to Maven Central.
                                 This is the recommended setting for releases, as it allows us to manually inspect the staged repository
                                 in the Central Portal before officially publishing.
                                 For Snapshots, this parameter has no effect, as they are immediately available upon deployment. -->
                            <autoPublish>false</autoPublish>

                            <!-- instructs the plugin to wait until Sonatype's portal validates the artifacts.
                                 This ensures that the build doesn't complete until the artifacts have passed initial quality checks.
                                 Other options like ready or published can be used to control the waiting time. -->
                            <waitUntil>validated</waitUntil>

                            <!-- let build fail if a publishing error occurs.
                                 This is a crucial safety measure to prevent incomplete or incorrect artifacts from being left in a staged repository. -->
                            <failOnBuildFailure>true</failOnBuildFailure>

                            <!-- generates all available checksum types (e.g., MD5, SHA-1, SHA-256) for the deployed artifacts -->
                            <checksums>all</checksums>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>

    </profiles>

</project>

