<?xml version="1.0" encoding="UTF-8"?>
<!--
  im2be-platform-libs — Stage B Wave PLATFORM v1.0 scaffold.

  Shared Spring Boot 3.5.14 / Java 17 libraries for the 8 aim2be Java services
  (admin / calendar / diary / family / notification / social-login / user /
  identity). Adopted as the substrate for the L-1 Full-Spec Library First
  decision per ADR-0014 D-2 + CONT-3 Option A.

  Modules (each shipped as a separate JAR consumed by services via
  dependencyManagement):

    - outbox-publisher          — PG-backed outbox poller + AFTER_COMMIT relay
    - processed-kafka-events    — consumer-side compound-PK dedup
    - apicurio-client           — Apicurio (primary) / Confluent wire-format
                                  (fallback) dual schema-registry abstraction
    - outbox-test-fixtures      — JUnit Jupiter helpers for downstream tests
    - archunit-rules            — @Entity ↔ @Version parity ArchRule + others

  Distribution model (Day-1):
    - Built locally + installed to `~/.m2/repository` via `mvn install`.
    - Published to Forgejo's native Maven package registry on tag push
      (TODO PR-PLATFORM-CI-1: configure `distributionManagement` + the
      `altDeploymentRepository` flag in CI).

  Version policy (per L-21 — Spring Boot harmonization):
    - Spring Boot 3.5.14 baseline (matches L-21 target across all 7 services
      + identity-service).
    - Java 17 (matches Spring Boot 3.5.x minimum).
    - groupId / version are uniform across modules; consumers pin a single
      property `im2be-platform-libs.version` in service POMs.

  Build-time invariants (rule 62 — clean compilation):
    - `mvn install` must exit 0 with ZERO [WARNING] lines.
    - ArchUnit module must publish its own self-test that proves the
      EntityVersionParity rule fires correctly against a deliberate
      negative fixture (lands in PR-PLATFORM-5).

  Cross-refs:
    - ADR-0001 §1.4 — @Version parity ArchUnit rule
    - ADR-0002 §3b — Avro schemas for ticket lifecycle (apicurio-client
                     downstream consumer)
    - ADR-0011 §B  — Apicurio primary, Confluent wire-format fallback
    - ADR-0014 D-2 — outbox + record_version parity, library-first delivery
-->
<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>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.5.14</version>
        <relativePath/>
    </parent>

    <groupId>com.aim2be</groupId>
    <artifactId>im2be-platform-libs-parent</artifactId>
    <version>1.1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>im2be-platform-libs (parent)</name>
    <description>
        Shared Spring Boot libraries for aim2be Java services (Stage B Wave
        PLATFORM v1.0). Outbox publisher, processed-kafka-events dedup,
        Apicurio client, test fixtures, ArchUnit rules.
    </description>

    <modules>
        <module>outbox-publisher</module>
        <module>redis-outbox-backend</module>
        <module>processed-kafka-events</module>
        <module>apicurio-client</module>
        <module>outbox-test-fixtures</module>
        <module>archunit-rules</module>
        <module>error-event-publisher</module>
    </modules>

    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Pinned third-party versions (rule 9 — pin explicitly, rule 61 —
             verify against current upstream docs before any bump). -->
        <archunit.version>1.3.0</archunit.version>
        <apicurio.client.version>2.5.11.Final</apicurio.client.version>
        <!-- Shared across outbox-publisher + redis-outbox-backend. Verified
             against Maven Central / upstream release pages 2026-05-28. -->
        <resilience4j.version>2.2.0</resilience4j.version>
        <opentelemetry.version>1.43.0</opentelemetry.version>
        <testcontainers.version>1.20.4</testcontainers.version>
    </properties>

    <!--
      RESOLUTION repository for the forgejo-air registry. proto-observability
      (consumed by error-event-publisher) is published ONLY here, not to Maven
      Central, so a clean/ephemeral build — e.g. the Forgejo Actions runner,
      which has no ~/.m2/settings.xml priming forgejo-air — must be told where to
      find it, or it fails resolving com.aim2be:proto-observability:1.0.0 (#20).
      Anonymous READ is allowed (verified HTTP 200), so NO credentials are needed
      for resolution; the <server id="forgejo-air"> token in settings.xml is
      required only for DEPLOY (distributionManagement below).
    -->
    <repositories>
        <repository>
            <id>forgejo-air</id>
            <name>Forgejo affinity-intelligence-rework Maven registry</name>
            <url>https://git.hemoglobina.store/api/packages/affinity-intelligence-rework/maven</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>

    <!--
      Forgejo Maven package registry for the affinity-intelligence-rework org
      (PR-PLATFORM-CI-1). Makes 1.1.0-SNAPSHOT resolvable from a REMOTE so
      consumers (identity-service et al.) no longer rely on a local `mvn install`
      into ~/.m2 — a clean/ephemeral build can resolve the coordinate. Each
      consumer adds a matching <repositories> entry pointing at the same URL; the
      credentials live ONLY in ~/.m2/settings.xml under <server id="forgejo-air">
      (a write:package + read:package Forgejo token), never in the POM.
      Deploy: `mvn -DskipTests deploy` from a JDK17 host (does not need the
      Forgejo Actions runner).
    -->
    <distributionManagement>
        <repository>
            <id>forgejo-air</id>
            <name>Forgejo affinity-intelligence-rework Maven registry</name>
            <url>https://git.hemoglobina.store/api/packages/affinity-intelligence-rework/maven</url>
        </repository>
        <snapshotRepository>
            <id>forgejo-air</id>
            <name>Forgejo affinity-intelligence-rework Maven registry (snapshots)</name>
            <url>https://git.hemoglobina.store/api/packages/affinity-intelligence-rework/maven</url>
        </snapshotRepository>
    </distributionManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <release>17</release>
                        <!-- Rule 62: zero warnings. Treat compiler warnings
                             as errors. Consumers that need to relax this for
                             a specific submodule must justify per rule 18. -->
                        <failOnWarning>true</failOnWarning>
                        <showWarnings>true</showWarnings>
                        <compilerArgs>
                            <arg>-Xlint:all</arg>
                            <arg>-Xlint:-processing</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.2.5</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.2.5</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <!-- Published-artifact completeness (PR-PLATFORM-CI-1, reviewer R1).
             A shared library consumed by 8 services must ship -sources + -javadoc
             JARs so downstream IDE navigation works. Versions are managed by the
             spring-boot-starter-parent BOM (rule 9 — pinned upstream). Inherited
             by every child JAR module; the pom-packaged parent skips both. -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <!-- Pin to 3.11.2 (rule 9 — explicit version; rule 61 —
                     verified against the Maven users mailing-list thread
                     2026-05-30, https://www.mail-archive.com/users@maven.apache.org/msg146691.html).
                     The spring-boot-starter-parent 3.5.14 BOM resolves this
                     plugin to 3.11.3, which has a REGRESSION: it unconditionally
                     logs "[WARNING] Javadoc 1.4+ doesn't support the -1.1 switch
                     anymore. Ignore this option." on every javadoc:jar run. The
                     warning is spurious (no -1.1 switch is actually used: the
                     `old` parameter defaults to false and we set <release>17),
                     but it breaks the repo's zero-warning gate (rule 62). 3.11.3
                     exposes NO configuration knob to suppress it; the fix shipped
                     in the plugin's main branch is not yet released. 3.11.2 is the
                     last release without the regression and is otherwise
                     behaviour-compatible. Remove this pin once the parent BOM
                     ships a maven-javadoc-plugin > 3.11.3 with the fix. -->
                <version>3.11.2</version>
                <configuration>
                    <!-- Java 17 source compatibility — keep the javadoc tool's
                         `-source`/`-release` aligned with the compiler plugin
                         (which uses <release>17</release>); the javadoc `release`
                         param otherwise defaults to ${maven.compiler.release},
                         which this POM does not set. Verified against the
                         maven-javadoc-plugin docs 2026-05-30 (rule 61). -->
                    <release>17</release>
                    <!-- Validate that the javadoc which EXISTS is well-formed
                         (HTML, @link targets, tag syntax) but do NOT fail on
                         "missing" comments — the standard published-library
                         doclint group. Javadoc renders public+protected API only
                         (private fields are excluded), and not every public enum
                         constant carries prose; the consumed-API docs (every
                         public class + method, per the repo convention) are what
                         the -javadoc JAR is for. -missing keeps the JAR shippable
                         without lowering validation of real javadoc defects. -->
                    <doclint>all,-missing</doclint>
                    <quiet>true</quiet>
                    <!-- Register the standard JDK documentation tags so javadoc
                         does not error on them (the code uses @apiNote per the
                         JDK convention; without this the tool reports
                         "unknown tag: apiNote"). -->
                    <tags>
                        <tag>
                            <name>apiNote</name>
                            <placement>a</placement>
                            <head>API Note:</head>
                        </tag>
                        <tag>
                            <name>implSpec</name>
                            <placement>a</placement>
                            <head>Implementation Requirements:</head>
                        </tag>
                        <tag>
                            <name>implNote</name>
                            <placement>a</placement>
                            <head>Implementation Note:</head>
                        </tag>
                    </tags>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
