ADR 0005: Decoupled Maven Multi-Repo Architecture
Author: AirCommerce Architecture Team • Scope: boot-base-super-pom
1. Context and Problem Statement
Section titled “1. Context and Problem Statement”AirCommerce operates a multi-repo microservice platform using Spring Boot and OpenTelemetry. Initially, dependency versions and Java frameworks (like Tomcat, Security, and Swagger) were tightly coupled into a single parent POM. This created several critical issues:
- Release Cascades: Bumping a single dependency version forced a release of the global Super POM, which subsequently forced every downstream microservice to update their parent version.
- Inflexible Inheritance: Because Spring Boot starters were hardcoded in the parent POM alongside build tooling, separating platform-level concerns (Docker, CI/CD) from framework-level concerns (Security, Web) was impossible.
- Component Bloat: Test utilities (like WireMock and Testcontainers) were leaking into production runtime jars due to missing Maven scopes on
test-support-library, increasing Docker image size and attack surface. - Scattered Version Management: Dependency versions were spread across multiple POMs with no single authoritative source, making CVE patching error-prone.
2. Decision Drivers
Section titled “2. Decision Drivers”- Decoupled Release Lifecycles: Teams must be able to upgrade dependencies independently without waiting for a global platform release.
- Separation of Concerns: Maven build infrastructure (Docker, JaCoCo, gitflow) must be physically separated from Java application frameworks (Security, Web, OpenTelemetry).
- DRY (Don’t Repeat Yourself): Eliminate duplicated dependency declarations across libraries and POMs.
- Security & Vulnerability Management: Centralize all versions in one BOM so CVE patching is targeted and immediate.
3. Considered Options
Section titled “3. Considered Options”- Option 1: Monolithic Super POM
- Option 2: Version Properties in Super POM without a BOM
- Option 3 (Chosen): Strict Decoupled Hierarchy (BOM + Super POM + Libraries)
4. Decision Outcome
Section titled “4. Decision Outcome”We chose Option 3, because it clearly separates Maven build mechanics from Java application frameworks, granting downstream teams maximum flexibility while maintaining strict CI/CD standardization.
4.1. The Version Catalog (aircommerce-bom)
Section titled “4.1. The Version Catalog (aircommerce-bom)”A centralized Bill of Materials handles all dependency versioning in one place. It enforces correct BOM import order (OpenTelemetry BOMs are imported before Spring Boot to prevent version downgrades) and pins vulnerability fixes. All other modules import it via <scope>import</scope> in their dependencyManagement sections — no version numbers appear anywhere else in the codebase.
4.2. The Build Blueprint (boot-base-super-pom)
Section titled “4.2. The Build Blueprint (boot-base-super-pom)”A Maven Super POM that wires the two AirCommerce platform libraries and provides the DevOps infrastructure inherited from release-super-pom (Docker registry rules, Spring Boot Maven plugin, JaCoCo). It declares:
core-library— the production Java stack, available to all services at compile scopetest-support-library— the shared test stack, fenced to<scope>test</scope>so test-only JARs never enter production fat-JARslombok— at<scope>provided</scope>so annotation processing works but lombok is never bundled
4.3. The Production Stack (library-core)
Section titled “4.3. The Production Stack (library-core)”A shared library that physically contains reusable Java configuration classes (Security, Keycloak JWT converter, Feign, OpenAPI config) and explicitly declares all Spring Boot starters required to compile and run them. Services get this entire stack automatically by inheriting boot-base-super-pom.
4.4. The Test Stack (library-test-support)
Section titled “4.4. The Test Stack (library-test-support)”A dedicated test support library that ships reusable test infrastructure (BaseControllerTest, @WithMockUser, SpringTestConfiguration) alongside its required test framework dependencies (MockMvc, Spring Security Test, Testcontainers, WireMock). All classes live in src/main/java with compile-scoped deps — the standard pattern used by Spring Boot’s own test libraries. Test dep leakage to production is prevented by boot-base-super-pom declaring it with <scope>test</scope>.
4.5. Implementation Mechanics
Section titled “4.5. Implementation Mechanics”Downstream services only need to declare their own application-specific dependencies. The entire platform stack (Web, Security, OAuth2, OpenTelemetry, Actuator, Testcontainers, WireMock, MockMvc) is inherited automatically:
<parent> <groupId>one.aircommerce.pom</groupId> <artifactId>boot-base-super-pom</artifactId> <version>1.0.0-SNAPSHOT</version></parent>
<dependencies> <!-- Only service-specific deps go here --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency>
<!-- Service-specific test containers --> <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers-mongodb</artifactId> <scope>test</scope> </dependency></dependencies>The full four-layer inheritance chain at a glance:
aircommerce-bom ← all versions (single source of truth) ↑release-super-pom ← CI/CD plugins: JaCoCo, gitflow, enforcer, surefire ↑ ↑library-core library-test-support ← both import aircommerce-bom ↑ (compile) ↑ (test scope)boot-base-super-pom ← wires libs + spring-boot-maven-plugin ↑service-* ← only service-specific deps declared here5. Pros and Cons of the Options
Section titled “5. Pros and Cons of the Options”Option 1: Monolithic Super POM
Section titled “Option 1: Monolithic Super POM”- Good: Easy to view all dependencies in a single file.
- Bad: Massive coupling — a single dependency bump forces a global platform release. Build tooling and Java frameworks are entangled in the same file. Test dependencies are highly prone to scope leakage.
Option 2: Version Properties in Super POM without a BOM
Section titled “Option 2: Version Properties in Super POM without a BOM”- Good: Allows teams to override versions using properties.
- Bad: Still conflates build infrastructure with Java frameworks. No single authoritative version catalog. Hard to enforce correct BOM import ordering for ecosystems like OpenTelemetry.
Option 3 (Chosen): Strict Decoupled Hierarchy
Section titled “Option 3 (Chosen): Strict Decoupled Hierarchy”- Good: Total separation of concerns across four layers. CVE patching is localized to the BOM. Test dependencies are strictly fenced by scope.
release-super-pomcan evolve independently of the Java stack. All services automatically inherit the correct production and test stacks viaboot-base-super-pom. - Bad: Slight initial learning curve for developers to understand the four-layer inheritance structure.
6. Validation and Verification Strategy
Section titled “6. Validation and Verification Strategy”- Maven Enforcer Rule: Configured in
release-super-pomwithDependencyConvergenceandrequireUpperBoundDepsto mathematically ensure zero version clashes or accidental downgrades. - Packaging Scope Auditing: CI pipelines run
mvn dependency:tree -Dincludes=org.testcontainersto prove that test libraries are excluded from production fat JARs. - Automated CVE Scans: Dependabot / Trivy scans evaluate the centralized
aircommerce-bom, ensuring vulnerability alerts target a single source file.
7. Migration and Rollout Consequences
Section titled “7. Migration and Rollout Consequences”- Microservice Migration: Downstream repositories must change their
<parent>reference toboot-base-super-pomand delete hardcoded versions for dependencies managed byaircommerce-bom. - Pipeline Standardization: Standardizes Maven build arguments and plugins across all repository CI/CD runners.
8. Links and Traceability
Section titled “8. Links and Traceability”aircommerce-bom— centralized version catalogrelease-super-pom— CI/CD plugin configurationlibrary-core— production Java stacklibrary-test-support— shared test infrastructure