Scrivio Interview library
ConceptIntermediate7 min read · updated 12 November 2026

What are the main changes in Maven 4 compared with Maven 3, and what should you check before moving builds? Mention the build POM versus consumer POM.

Maven 4 separates the build POM, the file we write, which can use the new 4.1.0 model, from the consumer POM that is published to repositories and stays compatible with Maven 3 users. It improves reactor handling, such as resuming failed builds and the new subprojects naming, infers parent and subproject versions in multi-module builds, and validates POMs more strictly. Maven itself needs Java 17 to run, and old plugins that rely on deprecated Maven 2 era APIs may stop working, so we update plugins and try the build on Maven 4 in CI next to Maven 3 before switching the wrapper.

Why this question is asked

Maven 3 has been the standard for well over a decade, so Maven 4 is the first major change most Java teams will live through. It is designed to be compatible, but it changes enough that a careless switch can break builds, especially those with old plugins. Interviewers ask this to see whether we know what is new, why the build POM and consumer POM split matters, and how to check readiness. In this answer, we will recap the problem the split solves, look at the build and consumer POM, go through the other main changes, and then see what to check before moving.

1The Problem: One POM for Two Audiences

In Maven 3, the pom.xml we write is also the file published next to our jar in the repository. That single file serves two very different readers. The build needs everything: modules, plugins, profiles, build settings. A library user, someone who depends on our jar, only needs our coordinates and our dependencies. But they get the whole file, including our build details, and the POM format can never change much, because every old Maven client in the world must still read it.

That compatibility requirement is the main reason the POM format barely changed for years. Any new feature in the file we write would break consumers using older tools.

2Build POM and Consumer POM

Maven 4 separates the two. The build POM is the file we write and keep in the project. It may use the new model version 4.1.0, with new elements and shorthand that only Maven 4 understands. When we install or deploy, Maven 4 generates a consumer POM from it: a simpler file in the 4.0.0 model, with inferred values filled in and build-only information removed, which Maven 3 and other tools can read as before.

XML
<!-- build POM: what we write (model 4.1.0) -->
<project xmlns="http://maven.apache.org/POM/4.1.0">
<modelVersion>4.1.0</modelVersion>
<parent/> <!-- parent coordinates inferred from ../pom.xml -->
<artifactId>orders-api</artifactId> <!-- version inferred from the parent -->
<dependencies>
<dependency>
<groupId>com.acme</groupId>
<artifactId>common</artifactId> <!-- reactor sibling: version inferred -->
</dependency>
</dependencies>
</project>
<!-- consumer POM: what is published (model 4.0.0), simplified -->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.acme</groupId>
<artifactId>orders-api</artifactId>
<version>2.4.0</version> <!-- filled in -->
<dependencies>
<dependency><groupId>com.acme</groupId><artifactId>common</artifactId><version>2.4.0</version></dependency>
</dependencies>
</project>
Step throughWhere each POM goes
DeveloperMaven 4RepositoryLibrary user
build POM, model 4.1.0
build with all build information
deploy jar and consumer POM, model 4.0.0
resolve orders-api 2.4.0 with Maven 3 or 4
consumer POM: coordinates and dependencies

5 messages in order. Play them, or step through them one at a time.

New features stay on the build side; consumers see a compatible file.

The exact rules for what is kept and removed in the consumer POM are in the Maven 4 documentation; check the version you use. The point is the separation: the build file can evolve, while the published file stays what consumers already understand.

3Better Reactor Handling and Version Inference

Several Maven 4 changes make multi-module builds easier. In the 4.1.0 model, the modules element is renamed subprojects, which is clearer, since a module is often confused with a Java module. Within a multi-module build, a child can omit its parent's version and its siblings' versions, and Maven infers them from the reactor, so a version bump touches one file instead of every module. CI-friendly version placeholders such as ${revision} are supported without extra plugins.

The reactor also behaves better. A new -r (or --resume) option resumes a failed build from where it stopped, without typing the module name. Maven 4 is also more careful with options like -pl when modules have their own subprojects. Check the release notes for the exact list.

4Stricter Validation and Plugin Compatibility

Maven 4 validates POMs more strictly. Things Maven 3 accepted with a warning, such as duplicate dependency declarations or some invalid values, may become errors. Most of these are real mistakes, so fixing them is good, but it means a build that is green on Maven 3 can fail on Maven 4 before compiling anything.

The bigger risk is plugins. Maven 3 still carried compatibility layers for Maven 2 era APIs, and some old plugins rely on them. Maven 4 removes or restricts parts of these, so such plugins can fail, often with errors about missing classes or components. Recent versions of the common plugins are compatible, which is why updating plugins is the first step. Maven 4 also needs Java 17 or later to run Maven itself; our project can still compile for an older Java with release, but the JDK running Maven must be at least 17. Check the release notes for the exact requirement.

Maven 3 versus Maven 4 at a glance
AreaMaven 3Maven 4
POM model4.0.0 for build and consumers4.1.0 build POM, 4.0.0 consumer POM
Multi-module namingmodulessubprojects (4.1.0 model)
Parent and sibling versionsRepeated in every moduleInferred inside the reactor
Resume after failure-rf :module-rf, plus -r to resume automatically
Java to run MavenJava 8 or later (check version)Java 17 or later
ValidationLenient, many warningsStricter, some warnings become errors

5What to Check Before Moving

First, update plugins to recent versions, especially compiler, Surefire, Failsafe, Enforcer, shade and any less common plugin, and look up each plugin's Maven 4 compatibility. Second, make sure the JDK that runs Maven is 17 or later on every developer machine and CI image. Third, run the build on Maven 4 as an extra CI job alongside the normal Maven 3 job, so failures are visible without blocking anyone.

Text
# extra CI job: same project, Maven 4 via the wrapper property override
$ ./mvnw wrapper:wrapper -Dmaven=4.0.0 # on a branch, or use a Maven 4 CI image
$ ./mvnw -B -ntp verify
# compare: build result, warnings, produced artifacts and published POMs

Only when that job is green and the produced artifacts match do we switch the wrapper version in the main branch. And we keep writing 4.0.0 model POMs at first; adopting the 4.1.0 model is a separate, later step, because a 4.1.0 build POM cannot be built by Maven 3 at all. The version shown is an example; use the current Maven 4 release.

6Follow-up questions

What benefits does the separate consumer POM give to library users?

They get a smaller, cleaner POM with only what they need: coordinates, dependencies and their versions, without our build plugins, profiles and module lists. Values that were inferred or came from placeholders are already filled in, so their tools do not have to resolve our parent chain to understand our dependencies. And because the consumer POM stays in the 4.0.0 model, library users on Maven 3, Gradle or other tools keep working even when the library's own build adopts new Maven 4 features.

Can a Maven 3 user build a project that uses the 4.1.0 model?

No. Maven 3 does not understand model version 4.1.0, so it cannot read such a build POM. That is why a company should only adopt 4.1.0 features in a project once everyone who builds it, including CI, uses Maven 4. Consuming the published artifacts is fine either way, because of the consumer POM.

Do we need Maven 4 to get faster builds?

Not necessarily. Maven 4 improves reactor behaviour and correctness, but much of the speed comes from parallel builds, mvnd and the build cache extension, which also work with Maven 3. We should measure before expecting a large speed-up from the upgrade itself.

7Conclusion

In this answer, we saw that Maven 4 separates the build POM we write, which can use the 4.1.0 model, from the consumer POM it publishes in the compatible 4.0.0 model. It improves multi-module builds with subprojects, version inference and better resume support, and validates more strictly. Maven 4 needs Java 17 to run, and plugins using old Maven 2 era APIs may break, so we update plugins and run the build on Maven 4 in CI next to Maven 3 before switching the wrapper.

What to say in the interviewAbout 90 seconds aloud

Open with

The biggest change is the split between the build POM and the consumer POM. In Maven 3 the pom.xml we write is exactly what gets published, so it serves both the build and library users, and its format could hardly change.

Then, if they want more

In Maven 4 we write a build POM, which can use the new 4.1.0 model, and when we deploy, Maven generates a consumer POM in the old 4.0.0 model with inferred values filled in and build details removed. So library users on Maven 3 or Gradle keep working while our build can use new features.

Other changes help multi-module builds: modules is renamed subprojects in the new model, parent and sibling versions can be inferred inside the reactor, CI-friendly placeholders like revision work natively, and there is a resume option that continues from the last failure. Validation is stricter, so some Maven 3 warnings become errors. Before moving, I would check three things.

Maven 4 needs Java 17 to run, so every machine and CI image needs that. Old plugins that rely on Maven 2 era APIs may fail, so I would update all plugins and check their compatibility. And I would run Maven 4 as an extra CI job next to Maven 3 until it is green, then switch the wrapper. Adopting the 4.1.0 model comes later, because Maven 3 cannot build it.

About this answer

Last updated
12 November 2026
Versions it names
Java 17
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Apache Maven guides
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "What are the main changes in Maven 4 compared with Maven 3, and what should you check...": https://scrivio-interview-library.netlify.app/java/maven/37ce1d1356/