Chapter 14Lesson 01~170 minutes

Maven 4 Preview, Build Consumer POM, Compatibility, Migration Planning, and Maven 3 Production Baselines: Concepts, Architecture, and Mental Model

Build a migration mental model that keeps Maven 3 production reality separate from Maven 4 release-candidate behavior, Java requirements, consumer POM transformation, and compatibility risk.

Maven 4MigrationConsumer POMModel 4.1.0Compatibility

A major build-tool upgrade is not a command substitution. It changes the runtime that interprets your build model, the compatibility surface exposed to plugins and extensions, the metadata that may be published for consumers, and the CI image that becomes part of every release. This lesson turns Maven 4 into a migration problem with evidence and rollback—not a “newer is automatically better” problem.

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. The Maven 4 curriculum title still says “Preview” because the current Maven 4 line is release-candidate software. If that status changes in the future, the lesson must be re-verified rather than preserving this status claim by habit.

Learning objectives

  • Distinguish Maven 3.9.16 GA production state from Maven 4.0.0-rc-6 compatibility-test state.
  • Explain why Maven 4 needs Java 17 to run while the project may still target another Java release through compiler/toolchain configuration.
  • Distinguish a source/build POM from the consumer-oriented POM Maven 4 can install or deploy.
  • Explain why model version 4.0.0 is the low-risk first migration target and when model 4.1.0 intentionally ends Maven 3 compatibility.
  • Identify plugin, extension, lifecycle, CI, repository, and artifact-identity compatibility surfaces before adoption.
  • Use mvnup as an inspection/migration aid without treating automated edits as proof that a migration is safe.

1. The practical problem: a Maven upgrade changes the interpreter of your build

Under Maven 3, your repository contains a declared model—usually a pom.xml using model 4.0.0—plus wrapper files, plugins, dependencies, settings boundaries, and CI assumptions. Maven core reads that model and orchestrates plugin code. Changing Maven core changes the interpreter and therefore can change validation rules, lifecycle semantics, plugin APIs, model transformation, warnings, or publication metadata even when the Java source code is unchanged.

The migration question is therefore not “does mvn verify exit zero under Maven 4?” It is: does the intended model still mean the same thing, do the required plugins/extensions still execute correctly, do tests and artifacts remain trustworthy, and can we roll back without damaging published state?

2. Release status is part of the build specification

Layer Current state on 2026-08-24 Operational meaning
Maven 3 3.9.16 GA Current production baseline for this course; supported Maven 3 line.
Maven 4 4.0.0-rc-6, not GA Test and report compatibility; do not silently standardize it as a production default.
Runtime JDK Maven 4 requires Java 17+ Launcher JDK requirement; not the same as the project bytecode target.
POM model 4.0.0 Supported by Maven 3 and Maven 4 Best starting point for dual-baseline compatibility testing.
POM model 4.1.0 Maven 4-only build model Unlocks Maven 4-specific features and intentionally gives up Maven 3 build compatibility.
mvnup Built into Maven 4 since rc-4 Migration analysis/editing tool; output still requires review and build evidence.
Release-candidate discipline: an RC can be high quality and useful for testing without being a GA production baseline. “It worked in one repository” and “Apache has declared it GA” are different facts.

3. Separate the Maven runtime JDK from the project target JDK

Maven 4 itself needs Java 17 or newer. That is the Java runtime that starts Maven core and loads plugins. Your project can still compile for a different supported target through the Maven Compiler Plugin or toolchains. In the lab we intentionally run both Maven 3.9.16 and Maven 4.0.0-rc-6 on JDK 21 and compile with release=17. Holding the launcher JDK constant prevents a Maven-vs-JDK confounding variable.

<properties>
  <maven.compiler.release>17</maven.compiler.release>
</properties>

If the Maven 4 lane fails because CI still uses Java 11, that is an environment-migration finding—not evidence that the application itself must suddenly target Java 17.

4. Build POM, effective model, and consumer POM are different artifacts

The build POM is the repository-owned model Maven uses to build the project. The effective model is Maven's merged/interpolated view after parent inheritance, defaults, profiles, and plugin management. A consumer POM is the downstream-facing metadata Maven 4 can derive for installed/deployed artifacts so consumers receive dependency/project information without unnecessary build-only detail.

Maven 4 model and publication flow
flowchart TD
  A[Build POM in source] --> B[Maven 4 model builder]
  B --> C[Effective build model]
  C --> D[Plugin lifecycle execution]
  C --> E[Consumer POM transformation]
  D --> F[JAR / reports]
  E --> G[Installed or deployed consumer metadata]
  F --> H[Artifact repository]
  G --> H

The first arrow is source interpretation. The second creates execution state. Lifecycle plugins produce artifacts and reports. Separately, Maven 4 can transform the build model into consumer-oriented metadata for installation/deployment. A successful transformation is not permission to publish to production; publication remains its own trust transition.

5. What the consumer-POM idea is solving

Build metadata such as compiler-plugin configuration helps produce an artifact but is usually irrelevant to a downstream project that merely consumes it. Maven 4 can publish a stripped/translated consumer POM, commonly represented as model 4.0.0 so Maven 3 and other consumers can keep resolving the artifact even if the source build POM uses Maven 4-only model features.

Current Maven documentation describes consumer POMs as removing build-only information, resolving inherited content, and preserving consumer-relevant dependency metadata. Do not assume the installed POM must textually match the source pom.xml. Instead verify the downstream contract: coordinates, dependency scopes/versions, repositories where appropriate, and the consumer's ability to resolve the artifact.

6. Model 4.1.0 is a feature boundary, not step one

Maven 4 can build ordinary model 4.0.0 projects. Apache's migration guide recommends first making the latest Maven 3 build clean, then testing that same Maven 3-compatible model under Maven 4, and only after compatibility is established introducing Maven 4-only features. Model 4.1.0 enables features such as a root attribute, <subprojects>, dedicated bom packaging, and richer inference, but a 4.1.0 build POM cannot be built by Maven 3.

Choice Who can build it? Why choose it now?
Model 4.0.0 Maven 3 and Maven 4 Dual-baseline compatibility; lowest migration coupling.
Model 4.1.0 Maven 4 only Use a Maven 4-only feature after Maven 3 rollback is no longer required.
Consumer POM derived from Maven 4 build Downstream consumers Keep published metadata consumable without exposing all build-only model detail.

7. Compatibility is wider than the POM schema

A Maven 4 readiness review must inventory: core extensions under .mvn/extensions.xml; plugins and their versions; scripts that parse exact log text; CI images and JDKs; Enforcer rules that constrain Maven versions; lifecycle bindings to phases whose semantics changed; custom tooling that uses Maven internal APIs; repository/publishing behavior; and any assumption that the source POM is byte-for-byte what downstream consumers receive.

Maven 4 aims to run Maven 3.9-compatible plugins that do not depend on old Maven 2/internal APIs, but that goal is not a guarantee for every plugin or extension. Compatibility belongs to each actual build graph.

8. Examples of Maven 4 behavior that deserve explicit review

Several Maven 4 changes are intentionally visible migration topics. Examples include stricter handling of malformed/duplicate declarations, new before:/after: lifecycle concepts replacing old pre/post patterns in relevant cases, changed install/deploy-at-end defaults, new root/subproject model features, and consumer-POM transformation. The point is not to memorize every Maven 4 feature now; the point is to recognize every changed semantic as a migration hypothesis requiring evidence.

9. mvnup is a migration assistant, not an approval authority

The Maven Upgrade Tool ships with Maven 4 from rc-4 onward. mvnup check analyzes and reports changes; mvnup apply edits POM files. Its default target model is 4.0.0, while --model-version 4.1.0 opts into Maven 4-only model syntax.

# From a verified Maven 4 distribution, read-only first:
mvnup check
mvnup check --model-version 4.1.0 --all

# Apply only in a disposable branch/copy after review:
mvnup apply --model-version 4.1.0 --all

The safe order is check → save output → review diff → build/test → compare artifacts/metadata → decide. “mvnup had no objections” is not equivalent to plugin, extension, CI, or artifact compatibility.

10. DevOps connection: major tool upgrades are platform migrations

A team standardizing Maven 4 changes developer bootstrapping, CI runner images, wrapper distributions, plugin compatibility, diagnostics, and possibly published metadata. That is platform work. A production migration needs an owner, test matrix, rollback path, artifact comparison, release-status gate, and a policy for when Maven 4-only POM features become allowed.

Knowledge check

Why does this chapter run Maven 3 and Maven 4 on the same JDK 21?

Does using Maven 4 require modelVersion 4.1.0 immediately?

What is the consumer POM for?

If mvnup check passes, is the project approved for Maven 4 production use?

What is the production baseline on 2026-08-24?

11. Bridge to the guided workflow

Lesson 2 creates two independently pinned lanes from the same source. You will verify the Maven 4 distribution before trusting it, compare builds and checksums, run mvnup check, then make a separate Maven 4-only model 4.1.0 copy to inspect consumer metadata without damaging the Maven 3 baseline.

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.