<?xml version="1.0" encoding="UTF-8"?>
<!--
  SPDX-FileCopyrightText: 2025 Stefano Chizzolini and contributors

  SPDX-License-Identifier: LGPL-3.0-only
-->
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.pdfclown</groupId>
  <artifactId>pdfclown-common-super</artifactId>
  <version>0.2.2</version>
  <packaging>pom</packaging>

  <name>${project.artifactId}</name>
  <description>Super build configuration for pdfClown.org projects (DO NOT use directly: use
pdfclown-common-base instead)</description>
  <!--
    NOTE: `url` is project-specific, MUST be explicitly declared in each inheriting project in order
    to override the default mechanism. -->
  <url>${projectRootUrl}</url>
  <inceptionYear>2025</inceptionYear>

  <organization>
    <name>pdfClown.org</name>
    <url>https://pdfclown.org</url>
  </organization>

  <licenses>
    <license>
      <name>LGPL-3.0-only</name>
      <url>https://spdx.org/licenses/LGPL-3.0-only.html</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>stechio</id>
      <name>Stefano Chizzolini</name>
      <url>https://stefanochizzolini.it</url>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
    </developer>
  </developers>

  <scm
      child.scm.connection.inherit.append.path="false"
      child.scm.developerConnection.inherit.append.path="false"
      child.scm.url.inherit.append.path="false">
    <connection>scm:git:https://${projectUrlBasePath}.git</connection>
    <developerConnection>scm:git:https://${projectUrlBasePath}.git</developerConnection>
    <tag>${scmTag}</tag>
    <url>${projectScmUrl}</url>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>${projectIssuesUrl}</url>
  </issueManagement>

  <properties>
    <!--
      ROOT-PROJECT-SPECIFIC PROPERTIES

      These properties MUST be specified in every root POM inheriting from this one.
    -->
    <projectUrlBasePath>github.com/pdfclown/pdfclown-common</projectUrlBasePath>

    <!--
      PROJECT-SPECIFIC PROPERTIES

      These properties MUST be specified in every POM inheriting from this one.
    -->
    <!--
      Path to the root project directory.
      This is an ugly workaround to the notorious lack of a standard way to point to the root
      project directory no matter the current project building in the reactor. -->
    <rootdir>${project.basedir}/..</rootdir>

    <!--
      THIRD-PARTY PROPERTIES
    -->
    <!--
      [mockito] DO NOT REMOVE `argLine` empty declaration (required for later @ reference
      resolution). -->
    <argLine/>
    <!--
      Enable javac `source` and `target` options (see
      <https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html>)

      NOTE: Modern javac (9+) provides `release` option (see
      <https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html>)
      to enforce code compliance with public JDK API; however, this mode is prone to various issues:
        - in certain cases, like JPMS module exports, javac `release` option is incompatible
        - JDK tools like javadoc may apply validation rules which are incompatible with source code
          targeting another JDK version

      Consequently, we stick to good old source+target options, constraining JDK to the same version
      via toolchain. -->
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!--
      Force surefire and failsafe to show the full stack on test failure. -->
    <trimStackTrace>false</trimStackTrace>

    <!--
      CUSTOM PROPERTIES
    -->
    <!--
      NOTE: Derived POMs MUST override this property either specifying their own filesystem-based
      resources path, or setting it empty (i.e., classpath-based resources) and declaring the build
      resources artifact (namely, pdfclown-common-build) as dependency of the plugins referencing
      those resources (BTW, some plugins support also the equivalent "classpath:" protocol, but
      that's not a standard practice, so we have to stick to common heuristics). -->
    <buildResourcesRootPath>${rootdir}/pdfclown-common-build/src/main/resources</buildResourcesRootPath>
    <checkstyleSkip>false</checkstyleSkip>
    <projectIssuesUrl>${projectRootUrl}/issues</projectIssuesUrl>
    <projectRootUrl>https://${projectUrlBasePath}</projectRootUrl>
    <projectScmUrl>${projectRootUrl}/tree/${project.scm.tag}</projectScmUrl>

    <!--
      DEPENDENCY VERSIONS

      NOTE: Brought here because of plugin-level references (otherwise, their natural place would
      be pdfclown-common-deps).
    -->
    <bytebuddy.version>1.18.2</bytebuddy.version>
    <classgraph.version>4.8.184</classgraph.version>
    <eventbus.version>3.3.1</eventbus.version>
    <groovy.version>5.0.3</groovy.version>
    <hamcrest.version>3.0</hamcrest.version>
    <indriya.version>2.2.3</indriya.version>
    <javaparser.version>3.27.1</javaparser.version>
    <javax.measure.version>2.2</javax.measure.version>
    <jimfs.version>1.3.1</jimfs.version>
    <json.version>20250517</json.version>
    <!--
      TODO: Whenever this version is updated, `json.version` MUST be aligned to its transitive
            org.json:json dependency.
    -->
    <jsonassert.version>2.0-rc1</jsonassert.version>
    <jsoup.version>1.21.2</jsoup.version>
    <jspecify.version>1.0.0</jspecify.version>
    <junit.version>5.14.1</junit.version>
    <log4j.version>2.25.3</log4j.version>
    <mockito.version>5.21.0</mockito.version>
    <reflections.version>0.10.2</reflections.version>
    <slf4j.version>2.0.17</slf4j.version>

    <!--
      PLUGIN VERSIONS
    -->
    <central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>
    <dependency-check-maven.version>12.1.9</dependency-check-maven.version>
    <flatten-maven-plugin.version>1.7.3</flatten-maven-plugin.version>
    <git-commit-id-maven-plugin.version>9.0.2</git-commit-id-maven-plugin.version>
    <gmavenplus-plugin.version>4.2.1</gmavenplus-plugin.version>
    <jada.version>0.1.2</jada.version>
    <java.version>17</java.version>
    <maven.version>3.9.11</maven.version>
    <maven-bundle-plugin.version>6.0.0</maven-bundle-plugin.version>
    <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
    <maven-checkstyle-plugin.puppycrawl.version>12.3.0</maven-checkstyle-plugin.puppycrawl.version>
    <maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
    <maven-dependency-plugin.version>3.9.0</maven-dependency-plugin.version>
    <maven-enforcer-plugin.version>3.6.2</maven-enforcer-plugin.version>
    <maven-failsafe-plugin.version>3.5.4</maven-failsafe-plugin.version>
    <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
    <maven-invoker-plugin.version>3.9.1</maven-invoker-plugin.version>
    <maven-jar-plugin.version>3.5.0</maven-jar-plugin.version>
    <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
    <maven-plugin-plugin.version>3.15.2</maven-plugin-plugin.version>
    <maven-shade-plugin.version>3.6.1</maven-shade-plugin.version>
    <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
    <maven-surefire-plugin.version>3.5.4</maven-surefire-plugin.version>
    <maven-toolchains-plugin.version>3.2.0</maven-toolchains-plugin.version>
    <sisu-maven-plugin.version>0.3.5</sisu-maven-plugin.version>
    <spotless-maven-plugin.version>3.1.0</spotless-maven-plugin.version>
    <spotless-maven-plugin.eclipseJdt.version>4.37</spotless-maven-plugin.eclipseJdt.version>
    <spotless-maven-plugin.eclipseWtp.version>4.21.0</spotless-maven-plugin.eclipseWtp.version>
    <xml-maven-plugin.version>1.2.0</xml-maven-plugin.version>
  </properties>

  <build>
    <defaultGoal>install</defaultGoal>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <targetPath>META-INF</targetPath>
        <directory>${rootdir}</directory>
        <includes>
          <include>LICENSE.txt</include>
          <include>NOTICE.txt</include>
        </includes>
      </resource>
    </resources>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven-enforcer-plugin.version}</version>
          <executions>
            <execution>
              <id>enforce-maven</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <phase>initialize</phase>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>3.9.9</version>
                  </requireMavenVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>io.github.git-commit-id</groupId>
          <artifactId>git-commit-id-maven-plugin</artifactId>
          <version>${git-commit-id-maven-plugin.version}</version>
          <configuration>
            <dateFormatTimeZone>UTC</dateFormatTimeZone>
          </configuration>
          <executions>
            <execution>
              <!--
                See also:
                - available properties (prepended with "git."): <https://github.com/git-commit-id/git-commit-id-plugin-core/blob/master/src/main/java/pl/project13/core/GitCommitPropertyConstant.java>
              -->
              <id>get-git-commit-info</id>
              <goals>
                <goal>revision</goal>
              </goals>
              <phase>initialize</phase>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.codehaus.gmavenplus</groupId>
          <artifactId>gmavenplus-plugin</artifactId>
          <version>${gmavenplus-plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.apache.groovy</groupId>
              <artifactId>groovy</artifactId>
              <version>${groovy.version}</version>
              <scope>runtime</scope>
            </dependency>
            <dependency>
              <groupId>org.apache.groovy</groupId>
              <artifactId>groovy-ant</artifactId>
              <version>${groovy.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>execute-jar-init</id>
              <goals>
                <goal>execute</goal>
              </goals>
              <configuration>
                <scripts>
                  <script><![CDATA[
import java.time.ZonedDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit

/*
  Timestamp for reproducible builds (see
  <https://maven.apache.org/guides/mini/guide-reproducible-builds.html>).

  NOTE: Reproducible builds are meaningful for SCM-traceable code only; therefore, the current
  commit's timestamp is used only if the working tree is clean. In case of dirty working tree, the
  timestamp is generated on the fly, following the volatility of the built code.
 */
var buildTimestamp = ${git.dirty}
    ? ZonedDateTime.now(ZoneOffset.UTC).truncatedTo(ChronoUnit.SECONDS)
        .format(DateTimeFormatter.ISO_INSTANT)
    : "${git.commit.time}"

// Share the build timestamp as property for interpolation!
session.userProperties.setProperty('buildTimestamp', buildTimestamp)

log.info("buildTimestamp: " + buildTimestamp
    + " (" + (${git.dirty} ? "DIRTY" : "REPRODUCIBLE") + ")")
]]></script>
                </scripts>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.pdfclown</groupId>
          <artifactId>jada-maven-plugin</artifactId>
          <version>${jada.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>processSource</goal>
              </goals>
              <configuration>
                <processors>org.pdfclown.jada.ext.proc.DocReuseTagletProcessor</processors>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <!--
            [#CodeFormat] Spotless.

            See <https://github.com/diffplug/spotless/tree/main/plugin-maven>
          -->
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>${spotless-maven-plugin.version}</version>
          <configuration>
            <!--
              NOTE: Only POM formatter is enabled on all projects; any other source code formatter
              is activated by a dedicated profile ("full-format") which can be easily switched off.
            -->
            <pom>
              <sortPom>
                <expandEmptyElements>false</expandEmptyElements>
                <indentAttribute>all</indentAttribute>
                <lineSeparator>\n</lineSeparator>
              </sortPom>
            </pom>
          </configuration>
        </plugin>
        <plugin>
          <!--
            [#CodeFormat] Checkstyle.

            IMPORTANT: This plugin works along with spotless-maven-plugin: whenever check rules
            change, code format MUST be updated accordingly.

            [Manual] To generate a report:
              ./mvnw checkstyle:checkstyle
          -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${maven-checkstyle-plugin.version}</version>
          <configuration>
            <excludeGeneratedSources>true</excludeGeneratedSources>
            <failOnViolation>true</failOnViolation>
            <includeResources>false</includeResources>
            <includeTestResources>false</includeTestResources>
            <linkXRef>false</linkXRef>
            <propertiesLocation>${rootdir}/src/conf/checkstyle/checkstyle.properties</propertiesLocation>
            <suppressionsLocation>${rootdir}/src/conf/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
            <configLocation>${buildResourcesRootPath}/org/pdfclown/common/build/conf/checkstyle/checkstyle-checks.xml</configLocation>
            <skip>${checkstyleSkip}</skip>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${maven-checkstyle-plugin.puppycrawl.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>sources-checkstyle</id>
              <goals>
                <goal>check</goal>
              </goals>
              <phase>process-sources</phase>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>${maven-plugin-plugin.version}</version>
          <executions>
            <execution>
              <id>mojo-descriptor-generate</id>
              <goals>
                <goal>descriptor</goal>
              </goals>
            </execution>
            <execution>
              <id>help-mojo-generate</id>
              <goals>
                <goal>helpmojo</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-toolchains-plugin</artifactId>
          <version>${maven-toolchains-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
          <configuration>
            <useIncrementalCompilation>false</useIncrementalCompilation>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven-dependency-plugin.version}</version>
          <executions>
            <execution>
              <goals>
                <!--
                  [mockito] Required by mockito to register its agent in maven-surefire-plugin
                  execution. -->
                <goal>properties</goal>
              </goals>
            </execution>
            <execution>
              <id>check-deps-usage</id>
              <goals>
                <goal>analyze-only</goal>
              </goals>
              <configuration>
                <failOnWarning>true</failOnWarning>
                <ignoreAllNonTestScoped>true</ignoreAllNonTestScoped>
                <!--
                  NOTE: Omitting runtime dependencies to avoid false positives. -->
                <ignoreNonCompile>true</ignoreNonCompile>
                <ignoredUsedUndeclaredDependencies>
                  <!--
                    NOTE: Omitting transitive test dependencies. -->
                  <item>com.google.jimfs</item>
                  <item>org.hamcrest</item>
                  <item>org.mockito</item>
                  <item>org.opentest4j:opentest4j</item>
                  <item>*junit*</item>
                </ignoredUsedUndeclaredDependencies>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
          <configuration>
            <!--
              [mockito] Required by mockito to register its agent (see
              <https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3>) -->
            <argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}</argLine>
            <redirectTestOutputToFile>true</redirectTestOutputToFile>
            <reportsDirectory>${project.build.directory}/test-logs/surefire</reportsDirectory>
            <systemPropertyVariables>
              <!-- Required by Maven Invoker (see
                <https://maven.apache.org/shared/maven-invoker/usage.html>) -->
              <maven.home>${maven.home}</maven.home>
            </systemPropertyVariables>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven-failsafe-plugin.version}</version>
          <configuration>
            <redirectTestOutputToFile>true</redirectTestOutputToFile>
            <reportsDirectory>${project.build.directory}/test-logs/failsafe</reportsDirectory>
            <systemPropertyVariables>
              <!-- Required by Maven Invoker (see
                <https://maven.apache.org/shared/maven-invoker/usage.html>) -->
              <maven.home>${maven.home}</maven.home>
            </systemPropertyVariables>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.eclipse.sisu</groupId>
          <artifactId>sisu-maven-plugin</artifactId>
          <version>${sisu-maven-plugin.version}</version>
          <executions>
            <execution>
              <id>sisu-index-generate</id>
              <goals>
                <goal>main-index</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>flatten-maven-plugin</artifactId>
          <version>${flatten-maven-plugin.version}</version>
          <configuration>
            <outputDirectory>${project.build.directory}</outputDirectory>
            <updatePomFile>true</updatePomFile>
          </configuration>
          <executions>
            <execution>
              <id>flatten</id>
              <goals>
                <goal>flatten</goal>
              </goals>
              <phase>process-resources</phase>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <!--
            [#PackageManifest] Basic package manifest.
          -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              </manifest>
              <manifestEntries>
                <Build-Timestamp>${buildTimestamp}</Build-Timestamp>
                <scm-commit-id>${git.commit.id}</scm-commit-id>
                <scm-commit-time>${git.commit.time}</scm-commit-time>
                <scm-describe>${git.commit.id.describe}</scm-describe>
                <scm-tags>${git.tags}</scm-tags>
                <scm-url>${projectScmUrl}</scm-url>

                <!--
                  TODO: Remove `Release-Jdk-Spec` entry when natively supported by
                        maven-jar-plugin (see <https://issues.apache.org/jira/browse/MJAR-323>,
                        <https://github.com/apache/maven-jar-plugin/issues/194>).

                  NOTE: This entry should be named `Target-Jdk-Spec` but, due to a bug in
                  maven-bundle-plugin, `Build-Jdk-Spec` entry is wrongly valued with the JDK
                  Maven runs under (e.g., 21) instead of the toolchain JDK (11): in order to avoid
                  resembling a weak compilation (target JDK 11 compiled on JDK 21, whilst the
                  actual toolchain is on JDK 11 itself), stronger `Release-Jdk-Spec` is used
                  instead.
                -->
                <Release-Jdk-Spec>${java.version}</Release-Jdk-Spec>
              </manifestEntries>
              <!--
                Append entries to the manifest generated by maven-bundle-plugin! -->
              <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <!--
            [#PackageManifest] OSGI-enhanced package manifest.
          -->
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>${maven-bundle-plugin.version}</version>
          <extensions>true</extensions>
          <configuration>
            <instructions>
              <Export-Package>*</Export-Package>
            </instructions>
          </configuration>
          <executions>
            <execution>
              <id>bundle-manifest-generate</id>
              <goals>
                <goal>manifest</goal>
              </goals>
              <phase>process-classes</phase>
              <configuration>
                <supportIncrementalBuild>true</supportIncrementalBuild>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>${maven-shade-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>xml-maven-plugin</artifactId>
          <version>${xml-maven-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
          <executions>
            <execution>
              <id>sources-attach</id>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <!--
              SOURCES (selection and representation)
            -->
            <excludePackageNames>*.internal:*.internal*</excludePackageNames>
            <!--
              FIXME: `sourcepath` was necessary because of an apparent bug affecting
                     maven-javadoc-plugin (when automatic module name (see "Automatic-Module-Name"
                     property herein) is enabled, maven javadoc plugin fails ("error: No source
                     files for package") - see also
                     <https://github.com/prometheus/client_java/issues/884#issuecomment-1791560944>)
            -->
            <sourcepath>${project.build.sourceDirectory}</sourcepath>

            <!--
              DOCLET
            -->
            <doclet>org.pdfclown.jada.core.Jada</doclet>
            <docletArtifacts>
              <!-- Bibliographic extension -->
              <docletArtifact>
                <groupId>org.pdfclown</groupId>
                <artifactId>jada-biblio</artifactId>
                <version>${jada.version}</version>
              </docletArtifact>
              <!-- UML diagram extension -->
              <docletArtifact>
                <groupId>org.pdfclown</groupId>
                <artifactId>jada-uml</artifactId>
                <version>${jada.version}</version>
              </docletArtifact>
            </docletArtifacts>
            <additionalJOptions>
              <additionalJOption>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</additionalJOption>
              <additionalJOption>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</additionalJOption>
              <additionalJOption>-J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED</additionalJOption>
            </additionalJOptions>
            <additionalOptions>
              <additionalOption>--jada-dir
                "${buildResourcesRootPath}/org/pdfclown/common/build/conf/javadoc/jada"</additionalOption>
              <additionalOption>--jada-dir "${rootdir}/src/main/javadoc/jada"</additionalOption>
              <additionalOption>--jada-exts JadaBiblio,JadaUML</additionalOption>
              <additionalOption>--biblio-used-only</additionalOption>
              <additionalOption>--uml-package-deps-exclude
                +*internal*,org.apache.logging.log4j.core.*</additionalOption>
              <additionalOption>--uml-package-deps-max-count 0</additionalOption>
              <!--
                NOTE: maven-javadoc-plugin doesn't accept absolute paths in `addStylesheets`
                property, so we have to feed it directly. -->
              <additionalOption>--add-stylesheet "${rootdir}/src/main/javadoc/stylesheet-ext.css"</additionalOption>
              <additionalOption>--allow-script-in-comments</additionalOption>
              <additionalOption>-tag "implSpec:a:Implementation Requirements:"</additionalOption>
              <additionalOption>-tag "implNote:a:Implementation Note:"</additionalOption>
              <additionalOption>-tag "apiNote:a:API Note:"</additionalOption>
            </additionalOptions>

            <!--
              TAGLETS

              NOTE: Unfortunately, current maven-javadoc-plugin implementation (3.10.1)
              doesn't support taglet auto-detection when taglet hierarchies span multiple
              artifacts (see <https://issues.apache.org/jira/browse/MJAVADOC-745>), so we are
              forced to explicitly list each and every taglet class.
              TODO: When this limitation is fixed, replace explicit definitions with this:
                <tagletArtifacts>
                  <tagletArtifact>
                    <groupId>org.pdfclown</groupId>
                    <artifactId>jada-biblio</artifactId>
                    <version>${jada.version}</version>
                  </tagletArtifact>
                </tagletArtifacts>
            -->
            <taglets>
              <!-- Jada doclet -->
              <taglet>
                <tagletClass>org.pdfclown.jada.core.taglet.IncludeTaglet</tagletClass>
              </taglet>
              <taglet>
                <tagletClass>org.pdfclown.jada.core.taglet.RenderTaglet</tagletClass>
              </taglet>
              <!-- Jada supplemental functionalities -->
              <taglet>
                <tagletClass>org.pdfclown.jada.ext.taglet.DocTaglet</tagletClass>
                <tagletArtifact>
                  <groupId>org.pdfclown</groupId>
                  <artifactId>jada-ext</artifactId>
                  <version>${jada.version}</version>
                </tagletArtifact>
              </taglet>
              <taglet>
                <tagletClass>org.pdfclown.jada.ext.taglet.ReuseDocTaglet</tagletClass>
              </taglet>
              <!-- Bibliographic extension -->
              <taglet>
                <tagletClass>org.pdfclown.jada.biblio.taglet.DocTaglet</tagletClass>
                <tagletArtifact>
                  <groupId>org.pdfclown</groupId>
                  <artifactId>jada-biblio</artifactId>
                  <version>${jada.version}</version>
                </tagletArtifact>
              </taglet>
              <taglet>
                <tagletClass>org.pdfclown.jada.biblio.taglet.RefTaglet</tagletClass>
              </taglet>
              <taglet>
                <tagletClass>org.pdfclown.jada.biblio.taglet.SpecTaglet</tagletClass>
              </taglet>
            </taglets>

            <!--
              CONTENTS (layout and resources)
            -->
            <!--
              NOTE: Weirdly enough, projects inheriting from this POM don't retrieve the text of the
              source overview.html file unless explicitly declared via `overview` parameter, despite
              its default path should be just this one. -->
            <overview>${basedir}/src/main/javadoc/overview.html</overview>
            <top><![CDATA[
<link rel="stylesheet" type="text/css" href="{@docRoot}/resources/highlight/prism.css">
<script src="{@docRoot}/resources/highlight/prism.js"></script>

<div class="header-top">
  <small>
    <a href="https://search.maven.org/artifact/${project.groupId}/${project.artifactId}">${project.groupId}:${project.artifactId}</a>:<a href="https://search.maven.org/artifact/${project.groupId}/${project.artifactId}/${project.version}/jar">${project.version}</a>
  </small>
</div>
]]></top>
            <bottom><![CDATA[
<span class="footer-right">${buildTimestamp} (${git.commit.id.describe})</span>
<span>Copyright &#169; {inceptionYear}&#x2013;{currentYear} {organizationName}. All rights reserved.<br>
<a href="${project.url}">Project Home</a> | <a href="${projectScmUrl}">Source Repository</a> | <a href="${projectIssuesUrl}">Report a bug or suggest an enhancement</a></span>
]]></bottom>

            <detectLinks>true</detectLinks>
            <dependencyLinks>
              <dependencyLink>
                <groupId>com.github.javaparser</groupId>
                <artifactId>javaparser-core</artifactId>
                <url>https://javadoc.io/doc/com.github.javaparser/javaparser-core/${javaparser.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>com.google.jimfs</groupId>
                <artifactId>jimfs</artifactId>
                <url>https://javadoc.io/doc/com.google.jimfs/jimfs/${jimfs.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>io.github.classgraph</groupId>
                <artifactId>classgraph</artifactId>
                <url>https://javadoc.io/doc/io.github.classgraph/classgraph/${classgraph.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>net.bytebuddy</groupId>
                <artifactId>byte-buddy</artifactId>
                <url>https://javadoc.io/doc/net.bytebuddy/byte-buddy/${bytebuddy.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <url>https://logging.apache.org/log4j/2.x/javadoc/log4j-api/</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
                <url>https://logging.apache.org/log4j/2.x/javadoc/log4j-core/</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.greenrobot</groupId>
                <artifactId>eventbus-java</artifactId>
                <url>https://javadoc.io/doc/org.greenrobot/eventbus-java/${eventbus.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest</artifactId>
                <url>https://javadoc.io/doc/org.hamcrest/hamcrest/${hamcrest.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <url>https://javadoc.io/doc/org.json/json/${json.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.jsoup</groupId>
                <artifactId>jsoup</artifactId>
                <url>https://javadoc.io/doc/org.jsoup/jsoup/${jsoup.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.jspecify</groupId>
                <artifactId>jspecify</artifactId>
                <url>https://javadoc.io/doc/org.jspecify/jspecify/${jspecify.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <url>https://junit.org/junit5/docs/${junit.version}/api/</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
                <url>https://javadoc.io/doc/org.junit.vintage/junit-vintage-engine/${junit.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <url>https://javadoc.io/doc/org.mockito/mockito-core/${mockito.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.pdfclown</groupId>
                <artifactId>pdfclown-common-util</artifactId>
                <url>https://javadoc.io/doc/org.pdfclown/pdfclown-common-util/0.2.2</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.reflections</groupId>
                <artifactId>reflections</artifactId>
                <url>https://javadoc.io/doc/org.reflections/reflections/${reflections.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.skyscreamer</groupId>
                <artifactId>jsonassert</artifactId>
                <url>https://javadoc.io/doc/org.skyscreamer/jsonassert/${jsonassert.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <url>https://javadoc.io/doc/org.slf4j/slf4j-api/${slf4j.version}</url>
              </dependencyLink>
              <dependencyLink>
                <groupId>tech.units</groupId>
                <artifactId>indriya</artifactId>
                <url>https://javadoc.io/doc/tech.units/indriya/${indriya.version}</url>
              </dependencyLink>
            </dependencyLinks>
            <!--
              NOTE: Disabling offline-links detection prevents their automatic synthesis (which is
              based on the arbitrary construct "{project.url}/apidocs") from interfering with their
              explicit configuration. -->
            <detectOfflineLinks>false</detectOfflineLinks>

            <nohelp>true</nohelp>
            <noindex>false</noindex>
            <!-- Suppress hidden timestamp for reproducible build. -->
            <notimestamp>true</notimestamp>

            <!--
              NOTE: Workaround to `-no-fonts` flag automatically added because of toolchain handling
              issue (the plugin wrongly evaluates the tool JDK version instead of the build JDK
              version, despite it's the latter to generate the javadoc - see also
              <https://github.com/apache/maven-javadoc-plugin/issues/1244>). -->
            <disableNoFonts>true</disableNoFonts>

            <archive>
              <addMavenDescriptor>true</addMavenDescriptor>
            </archive>

            <!--
              SYSTEM
            -->
            <!--
              - `-missing`: missing comments are ignored
              - `-html`: HTML 5 check is disabled, as it wrongly prohibits legal data attributes
                (e.g., `<pre data-line="5"><code>` used by Prism code highlighter) — see also
                <https://developer.mozilla.org/en-US/docs/Web/HTML/How_to/Use_data_attributes>
              - `-accessibility`: accessibility is disabled, as it weirdly interferes with things
                like heading tags (<h*>); in particular, after java 11, <h3> is
                forbidden <https://bugs.openjdk.org/browse/JDK-8223552>
            -->
            <doclint>all,-missing,-html,-accessibility</doclint>
            <quiet>true</quiet>
          </configuration>
          <executions>
            <execution>
              <id>javadoc-jar-generate</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
            <execution>
              <id>default-test-javadoc</id>
              <configuration>
                <sourcepath>${project.basedir}/src/test/java</sourcepath>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>${maven-invoker-plugin.version}</version>
          <configuration>
            <addTestClassPath>true</addTestClassPath>
            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
            <debug>true</debug>
            <preBuildHookScript>pre-build</preBuildHookScript>
            <postBuildHookScript>post-build</postBuildHookScript>
            <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
            <settingsFile>src/it/settings.xml</settingsFile>
          </configuration>
          <executions>
            <execution>
              <id>integration-test</id>
              <goals>
                <goal>integration-test</goal>
              </goals>
            </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>false</autoPublish>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!--
        TOOLCHAIN

        Isolates the JDK used to build the project from the one Maven is running under, similarly to
        how JDK versions can be set in IDEs like IDEA, NetBeans and Eclipse (see
        <https://maven.apache.org/guides/mini/guide-using-toolchains.html>).

        IMPORTANT: In order to work, `toolchains.xml` configuration file MUST contain the JDK
        version corresponding to the one referenced here below.
      -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-toolchains-plugin</artifactId>
        <configuration>
          <toolchains>
            <jdk>
              <!--
                NOTE: maven-toolchains-plugin doesn't match by version prefix (e.g., version "11"
                doesn't match a toolchain whose version is "11.0.25"), nor the Version Range
                Specification <https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html>
                provides any primitive way to express the condition "any version within the same
                major" (e.g., 'any version 11' can only be expressed as "[11,12)", but this implies
                defining also the upper bound major in another property (since the interpolation
                mechanism doesn't support a transformation to express `${java.version} + 1`); as a
                workaround, we specify an arbitrarily large minor (9) to cover all the plausible
                range. -->
              <version>[${java.version},${java.version}.9]</version>
            </jdk>
          </toolchains>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>toolchain</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>io.github.git-commit-id</groupId>
        <artifactId>git-commit-id-maven-plugin</artifactId>
      </plugin>

      <!-- Code formatting -->
      <plugin>
        <groupId>org.pdfclown</groupId>
        <artifactId>jada-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>

      <!-- Packaging -->
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>

      <!-- Testing -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-maven</id>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- MANUAL PROFILES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <profile>
      <id>full</id>
      <!--
        FULL EXECUTION PROFILE

        Activates the following operations:
        - javadoc jar
      -->
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>fast</id>
      <!--
        FAST EXECUTION PROFILE

        Deactivates the following operations to speed up build execution:
        - integration tests
      -->
      <properties>
        <skipITs>true</skipITs>
      </properties>
    </profile>

    <profile>
      <id>fast+</id>
      <!--
        FASTEST EXECUTION PROFILE

        Deactivates the following operations to speed up build execution:
        - unit tests
        - integration tests
      -->
      <properties>
        <skipTests>true</skipTests>
      </properties>
    </profile>

    <profile>
      <id>verify-extra</id>
      <!--
        EXTRA VERIFICATION PROFILE

        Maintenance checks to run periodically:
        - dependency vulnerability check (check-deps-vulnerability)
      -->
      <build>
        <plugins>
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <version>${dependency-check-maven.version}</version>
            <configuration>
              <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
              <failBuildOnCVSS>0</failBuildOnCVSS>
            </configuration>
            <executions>
              <execution>
                <id>check-deps-vulnerability</id>
                <goals>
                  <goal>aggregate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release</id>
      <!--
        DEPLOYMENT PROFILE

        Activates the following operations:
        - release execution via ReleaseManager

        Usage (IMPORTANT: run at project root):
          ./mvnw initialize -N -Prelease -Drelease.version=<semver2> \
              [-Drelease.startpoint=<release branch start-point ref>] \
              [-DdryRun]
      -->
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.gmavenplus</groupId>
            <artifactId>gmavenplus-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>org.pdfclown</groupId>
                <artifactId>pdfclown-common-build</artifactId>
                <version>0.2.2</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <id>execute-release</id>
                <goals>
                  <goal>execute</goal>
                </goals>
                <phase>initialize</phase>
                <configuration>
                  <scripts>
                    <script><![CDATA[
import org.pdfclown.common.build.release.ReleaseManager

final var USER_PROPERTY_NAME__DRYRUN = "dryRun"
final var USER_PROPERTY_NAME__RELEASE_STARTPOINT = "release.startpoint"
final var USER_PROPERTY_NAME__RELEASE_VERSION = "release.version"

final var releaseVersion = session.userProperties[USER_PROPERTY_NAME__RELEASE_VERSION]
if (releaseVersion == null)
  throw new IllegalStateException("\"" + USER_PROPERTY_NAME__RELEASE_VERSION + "\" user property MISSING")

new ReleaseManager(project.basedir.toPath(), releaseVersion)
    .setReleaseBranchStartPoint(session.userProperties[USER_PROPERTY_NAME__RELEASE_STARTPOINT])
    .setDeploymentProfiles("publish")
    .setInstallationProfiles("full")
    /* NOTE: Activates remote push only if GPG signing is configured. */
    .setRemotePushEnabled(System.getenv("MAVEN_GPG_PASSPHRASE") != null)
    .setDryRun(session.userProperties[USER_PROPERTY_NAME__DRYRUN] != null)
    .execute()
]]></script>
                  </scripts>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>publish</id>
      <!--
        (internal use only) DEPLOYMENT EXECUTION PROFILE

        Activates the following operations:
        - javadoc jar
        - gpg signing
        - maven central publishing

        IMPORTANT: It is caller's responsibiity to prepare the working tree for the deployment, in
        particular to check out the corresponding release tag.
      -->
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <configuration>
              <bestPractices>true</bestPractices>
              <gpgArguments>
                <!-- Unattended (non-interactive) execution -->
                <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>
            <!--
              NOTE: Transparently manages both public releases and snapshots. -->
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- AUTOMATED PROFILES  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!--
      NOTE: Because of definition order, these profiles take precedence over manual ones.
    -->

    <profile>
      <id>maven-plugin</id>
      <!--
        MAVEN PLUGIN PROFILE
      -->
      <activation>
        <property>
          <name>packaging</name>
          <value>maven-plugin</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <!--
                  Force MANIFEST generation!

                  NOTE: pdfClown-related manifest generation is delegated to
                  org.apache.felix:maven-bundle-plugin; since that plugin doesn't support
                  'maven-plugin' packaging, in such case we have to restore the default manifest
                  generator. -->
                <manifestFile
                    combine.self="override"/>
              </archive>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>flatten-maven-plugin</artifactId>
            <configuration>
              <flattenMode>ossrh</flattenMode>
              <pomElements>
                <build>remove</build>
                <inceptionYear>resolve</inceptionYear>
                <organization>resolve</organization>
              </pomElements>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>jar</id>
      <!--
        JAR ARTIFACT PROFILE
      -->
      <activation>
        <property>
          <name>packaging</name>
          <value>jar</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.gmavenplus</groupId>
            <artifactId>gmavenplus-plugin</artifactId>
            <executions>
              <execution>
                <id>execute-jar-init</id>
                <phase>initialize</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>flatten-maven-plugin</artifactId>
            <configuration>
              <flattenMode>ossrh</flattenMode>
              <pomElements>
                <build>remove</build>
                <inceptionYear>resolve</inceptionYear>
                <organization>resolve</organization>
              </pomElements>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>pom</id>
      <!--
        GENERIC POM PROFILE
      -->
      <activation>
        <property>
          <name>packaging</name>
          <value>pom</value>
        </property>
      </activation>
      <properties>
        <checkstyleSkip>true</checkstyleSkip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>flatten-maven-plugin</artifactId>
            <configuration>
              <flattenMode>resolveCiFriendliesOnly</flattenMode>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--
      TODO: Full POMs should be like fat jars, containing all the configuration merged from their
            ancestor POMs (which should be marked as "internal-pom" instead). The point is to avoid
            publishing fragmented POMs when they were split because of internal reasons.
            Unfortunately, flatten-maven-plugin notoriously reuses Maven's effective POM, which
            destroys ordering, formatting and comments of the original POM.

      <profile>
        <id>full-pom</id>
        <activation>
          <property>
            <name>packaging</name>
            <value>pom</value>
          </property>
          <file>
            <exists>.profile.full-pom</exists>
          </file>
        </activation>
        <build>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>flatten-maven-plugin</artifactId>
              <configuration>
                <flattenMode>resolveCiFriendliesOnly</flattenMode>
                <flattenDependencyMode>inherited</flattenDependencyMode>
                <pomElements combine.children="append">
                <build>expand</build>
                </pomElements>
              </configuration>
            </plugin>
          </plugins>
        </build>
      </profile>
    -->

    <profile>
      <id>internal-pom</id>
      <!--
        INTERNAL POM PROFILE

        Internal POMs are NOT published (as a consequence, their processed contents are not packaged
        either). Within a reactor, they are ancestors of other internal POMs or jar artifacts only;
        since jar artifacts' POMs are flattened (see 'jar' profile), they are redundant outside the
        project.
      -->
      <activation>
        <file>
          <exists>.profile.internal-pom</exists>
        </file>
      </activation>
      <properties>
        <gpg.skip>true</gpg.skip>
        <maven.deploy.skip>true</maven.deploy.skip>
        <maven.install.skip>true</maven.install.skip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>sources-attach</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>javadoc-jar-generate</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>default-jar</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>

          <!--
            NOTE: `skipPublishing` parameter doesn't work, so we have to force disabling via phase.
          -->
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>injected-central-publishing</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>bom</id>
      <!--
        BOM PROFILE

        Bill of Materials POMs are stripped of any build configuration and their dependencies'
        versions are interpolated.
      -->
      <activation>
        <property>
          <name>packaging</name>
          <value>pom</value>
        </property>
        <file>
          <exists>.profile.bom</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>flatten-maven-plugin</artifactId>
            <configuration>
              <flattenMode>bom</flattenMode>
              <pomElements>
                <properties>remove</properties>
                <dependencyManagement>extended_interpolate</dependencyManagement>
                <build>remove</build>
                <inceptionYear>resolve</inceptionYear>
                <organization>resolve</organization>
              </pomElements>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>full-format</id>
      <!--
        FULL-FORMAT PROFILE

        Fully-formatted source code. By default, projects are applied this profile unless they
        explicit opt-out via "no-format" marker file.
      -->
      <activation>
        <file>
          <missing>.profile.no-format</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <configuration>
              <!-- See <https://github.com/diffplug/spotless/tree/main/plugin-maven> -->

              <formats>
                <!--
                  WARNING: Avoid eclipseWtp for CSS formatting, it's buggy! corrupts property
                  declarations arbitrarily converting constants to strings, and breaks at-rule
                  names; for example:
                    font-family: inherit !important;
                  to
                    font-family: "inherit !important";
                  and
                    @right-middle {
                      . . .
                    }
                  to
                    @
                    right-middle {
                      . . .
                    }
                -->

                <format>
                  <includes>
                    <include>src/**/*.css</include>
                    <include>src/**/*.html</include>
                  </includes>
                  <!-- DO NOT alter test resources (their formatting may be significant) -->
                  <excludes>
                    <exclude>src/test/**/*</exclude>
                  </excludes>

                  <prettier>
                    <prettierVersion>2.0.5</prettierVersion>
                    <config>
                      <printWidth>100</printWidth>
                    </config>
                  </prettier>
                </format>

                <format>
                  <includes>
                    <include>src/**/*.xml</include>
                    <include>src/**/*.xsd</include>
                  </includes>

                  <eclipseWtp>
                    <version>${spotless-maven-plugin.eclipseWtp.version}</version>

                    <type>XML</type>
                    <files>
                      <file>${buildResourcesRootPath}/org/pdfclown/common/build/conf/eclipse/org.eclipse.wst.xml.core.prefs</file>
                    </files>
                  </eclipseWtp>
                </format>
              </formats>

              <java>
                <eclipse>
                  <version>${spotless-maven-plugin.eclipseJdt.version}</version>

                  <file>${buildResourcesRootPath}/org/pdfclown/common/build/conf/eclipse/java-style.xml</file>

                  <sortMembersEnabled>true</sortMembersEnabled>
                  <!-- Sort order of the member categories:
                  - T: (Nested) Types
                  - SF: Static Fields
                  - SI: Static Initializers
                  - SM: Static Methods
                  - F: Fields
                  - I: Initializers
                  - C: Constructors
                  - M: Methods -->
                  <sortMembersOrder>T,SF,SI,SM,F,I,C,M</sortMembersOrder>
                  <!-- Reordering of members of the same category by the visibility within the
                  category. -->
                  <sortMembersVisibilityOrderEnabled>true</sortMembersVisibilityOrderEnabled>
                  <!-- Ordering of members of the same category by the visibility within the category:
                  - B: Public
                  - R: Protected
                  - D: Package
                  - V: Private -->
                  <sortMembersVisibilityOrder>B,R,D,V</sortMembersVisibilityOrder>
                </eclipse>

                <removeUnusedImports/>
                <importOrder>
                  <file>${buildResourcesRootPath}/org/pdfclown/common/build/conf/eclipse/java.importorder</file>
                </importOrder>
                <trimTrailingWhitespace/>
              </java>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>ci</id>
      <activation>
        <property>
          <name>env.CI</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>compile</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>non-ci</id>
      <activation>
        <property>
          <name>!env.CI</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>apply</goal>
                </goals>
                <phase>process-sources</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
