Chapter 14Lesson 03~155 minutes

Maven 4 Preview, Build Consumer POM, Compatibility, Migration Planning, and Maven 3 Production Baselines: Configuration, Design Choices, and Tradeoffs

Choose when to stay on Maven 3, dual-test Maven 4, adopt model 4.1.0 features, or defer migration by connecting each choice to observable build and compatibility state.

Decision FrameworkDual BaselinePlugin CompatibilityCI CostRollback

Migration engineering is mostly boundary management. Maven 4 can be technically compatible with a project while still being the wrong organizational default today; conversely, staying on Maven 3 forever can accumulate upgrade debt. This lesson turns the choice into observable state and explicit tradeoffs.

Current status — verified 2026-08-24. Apache Maven 3.9.16 is the current GA Maven 3 baseline. Maven 4.0.0-rc-6, released 2026-08-04, is still not GA and is used here only for compatibility testing. Maven 4 requires Java 17+ to run; the lab uses JDK 21 for both Maven 3 and Maven 4 so the Maven version—not the launcher JDK—is the deliberate variable. Maven Wrapper 3.3.4 remains the stable wrapper baseline. Because Maven 4 is still rc-6, “adopt Maven 4” below means a controlled test or explicitly accepted pre-GA exception unless your organization has a separate risk decision. The default course production path remains Maven 3.9.16.

Learning objectives

  • Choose among Maven 3-only production, dual-baseline testing, and Maven 4-only model adoption.
  • Explain why model 4.0.0 is a compatibility strategy while 4.1.0 is a feature/rollback decision.
  • Evaluate plugin and extension compatibility separately from ordinary dependency compatibility.
  • Connect CI matrix cost to the value of early Maven 4 evidence.
  • Define measurable exit criteria for dropping Maven 3 rather than migrating by enthusiasm.
  • Use a worked scenario to justify a go/no-go choice from evidence.

1. Decide which state you are moving from and to

There are at least three distinct operating states:

State Build POM Runtime policy Primary purpose
A — Maven 3 production 4.0.0 3.9.16 GA Stable production baseline.
B — Dual-baseline migration 4.0.0 3.9.16 production + 4.0.0-rc-6 test Find Maven 4 incompatibilities while retaining immediate rollback.
C — Maven 4 feature adoption Often 4.1.0 when needed Maven 4 only Use Maven 4-only model/lifecycle features after dropping Maven 3 support.

Moving A → B changes test infrastructure but can leave source model semantics almost unchanged. Moving B → C is a larger contract change because model 4.1.0 build POMs require Maven 4.

2. Stay on Maven 3 versus test Maven 4 now

Question Stay Maven 3 only Add Maven 4 test lane
Release risk Lowest immediate toolchain churn. RC defects/behavior are isolated to non-release lane.
Migration knowledge Compatibility problems arrive later. Finds warnings/plugin/extension blockers early.
CI cost One runtime matrix. Second runtime/repository/evidence lane costs compute and maintenance.
Rollback Already on baseline. Simple because model 4.0.0 and Maven 3 release lane remain intact.
Developer experience One known toolchain. Developers learn future warnings/features without forcing production change.

At the current release status, State B is usually the rational learning posture: keep production on GA Maven 3, add controlled Maven 4 evidence, and make no Maven 4-only source-model commitment yet.

3. Model 4.0.0 versus 4.1.0: compatibility versus feature value

Model 4.0.0 is not “old Maven syntax that Maven 4 rejects.” It is the compatibility bridge. Model 4.1.0 should be justified by a feature you actually need—such as root metadata, <subprojects>, dedicated BOM packaging, or Maven 4 inference—not by version aesthetics.

Criterion Keep 4.0.0 Adopt 4.1.0
Maven 3 rollback required Yes. No; Maven 3 cannot build 4.1.0.
Need Maven 4-only model feature No. Yes, with tests for consumer metadata.
Published consumer compatibility Ordinary Maven metadata. Rely on Maven 4 consumer-POM translation; inspect output.
Migration diff size Smaller; core/runtime changes easier to isolate. Larger; model inference and new elements enter the diff.
Recommended sequencing First Maven 4 compatibility stage. After Maven 4 runtime compatibility is established.

4. Plugin compatibility and extension compatibility have different blast radii

Most ordinary plugins interact with Maven through supported plugin APIs and can often run unchanged under Maven 4 if they are current Maven 3.9-compatible releases. A core extension, custom plugin, or internal build tool may depend on Maven implementation classes and therefore has a deeper compatibility surface. One incompatible extension can prevent the project model from loading at all.

Inventory each executable build dependency by coordinates, version, source repository, minimum Maven/JDK requirements, and whether it uses public or internal APIs. Do not infer extension compatibility from application-dependency tests.

5. Consumer POM changes must be evaluated as an API contract

For a library, published POM metadata is part of the product interface. A migration that produces the same JAR checksum but changes dependency scopes or removes needed consumer metadata can still break users. Therefore compare both artifact bytes and installed/deployed POM semantics.

For an application that is never consumed as a Maven library, consumer metadata may be less critical, but publication policies can still use coordinates, provenance, or BOMs. Match the verification depth to the artifact role rather than assuming all repositories need the same checks.

6. Dual-baseline CI is valuable only when it is intentionally asymmetric

A useful transition matrix makes Maven 3 the release-authoritative lane and Maven 4 the compatibility lane. Both should run the same required tests and artifact checks where possible, but only the Maven 3 lane should publish production artifacts while Maven 4 remains RC.

# Platform-neutral CI sketch; syntax intentionally illustrative.
build-maven3-release-baseline:
  jdk: 21
  maven: 3.9.16
  goals: [clean, verify]
  publication: disabled-in-PR / production-policy-controlled

build-maven4-compatibility:
  jdk: 21
  maven: 4.0.0-rc-6
  goals: [clean, verify]
  publication: disabled
  allow_failure: false   # compatibility should be visible, not silently ignored

Do not duplicate the CI-platform course here. The build-engineering rule is what matters: independent pinned runtime, equivalent verification scope, no production publishing from the RC lane, and retained logs/checksums.

7. Carrying two baselines has a real cost

Dual testing increases CI time, cache space, wrapper/runtime maintenance, log review, and failure triage. That cost is justified while it is buying migration information. Define an exit condition: for example, Maven 4 reaches GA, required plugins/extensions are certified by your tests, consumer metadata is verified, release engineering approves the new runtime, and rollback has been rehearsed.

Without exit criteria, a “temporary” dual matrix can become permanent accidental complexity.

8. Worked scenario: a 25-module library platform

Assume a repository has 25 modules, publishes three libraries and one BOM, uses two custom corporate extensions, and must support a hotfix branch on Maven 3 for six months. Maven 4 rc-6 builds ordinary modules successfully, but one extension has no Maven 4 compatibility statement and the rc-6 notes contain a BOM consumer-POM property-reference issue.

Decision Choice Evidence-based reason
Production Maven runtime Keep 3.9.16 GA baseline and hotfix rollback contract remain active.
Maven 4 CI lane Enable rc-6 Find plugin/extension and model issues before GA.
Model 4.1.0 conversion Defer Would break Maven 3 hotfix builds and adds no required feature yet.
BOM publication from Maven 4 lane Disable Current rc-6 documents a relevant consumer-POM BOM known issue.
Custom extensions Test individually Core-extension compatibility is not proven by successful library modules.
Exit criterion GA + extension clearance + metadata comparison + rollback rehearsal Converts migration from opinion to controlled platform change.

9. Security and supply-chain implications

Testing a new Maven runtime adds another executable distribution and may resolve different plugin paths or exercise code paths not previously used. Verify the wrapper distribution checksum, pin plugins, use isolated local repositories for experiments, and do not inject production repository/signing credentials into the RC lane. If a plugin/extension failure tempts you to add random repositories or disable integrity controls, stop; that would turn a compatibility test into a supply-chain regression.

10. Upgrade cost is mostly the cost of unowned assumptions

Repositories with explicit wrappers, pinned plugins, clean effective POMs, no duplicate declarations, supported APIs, reproducible artifacts, and tests that fail correctly are easier to migrate. Hidden global settings, old extensions, log-parsing scripts, implicit JDKs, and mutable release processes make Maven 4 harder. Chapter 14 therefore measures build hygiene as much as Maven 4 itself.

Knowledge check

When is model 4.1.0 the wrong next step even if Maven 4 can build the project?

Why might the JAR checksum match while the migration is still unsafe for a library?

Should the Maven 4 RC compatibility lane publish production releases?

What is a stronger Maven 4 blocker: one warning or a core extension using removed/internal API?

Why define an exit condition for dual-baseline CI?

11. Bridge to diagnostics

Lesson 4 deliberately breaks the migration assumptions: unsupported Java, a Maven 4-stricter model error, a synthetic extension API failure, unexpected consumer metadata, and a missing rollback plan. You will diagnose each by preserving evidence rather than deleting caches or blindly editing until the build passes.

Official references and version notes

Version-sensitive statements in this lesson were checked against current Apache Maven primary documentation on 2026-08-24.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.