Skip to main content

Maven 4 for Java Developers: Build vs Consumer POM, New Lifecycle and Upgrade Checklist (4.0.0-rc-7)

Maven 4.0.0 is still a release candidate (4.0.0-rc-7, not GA). What changes for Java developers: the build POM vs consumer POM split, model 4.1.0, before:/after: lifecycle phases, mvnup and its Java-target trap, and mvnd. Every claim traced to a real build, with an upgrade checklist.

You have a Maven build that works. Somebody on the team says “we should move to Maven 4”, and the next hour goes to blog posts that list thirty new features, none of which tell you what will break on Monday. This article is the shorter, checked version. It covers the single idea that explains most of Maven 4 — your pom.xml and the POM that other people download are now two different files — and then the new lifecycle phases, the upgrade tool, and the traps that tool sets for you. Everything below was run against a real Maven 4 build; the companion project is asmhatre/java-devops-demo/maven4-build-vs-consumer-pom and every console block quotes a file from its output/ folder. The reference material (upgrade checklist, production checklist, plugin compatibility, the long tail) is folded into the expandable sections, so the main text stays a straight read.
Versions and status, plainly. Maven 4.0.0 has not reached GA as of 2026-11-26. What exists is 4.0.0-rc-7, a release candidate published on 2026-09-24. Maven Central’s maven-metadata.xml lists 4.0.0-rc-7 as both <latest> and <release> and has no 4.0.0 entry (output/01-versions.txt). Apache’s own download page offers it under “Preview 4.x Release” and says it is not safe for production use; the recommended release it offers is 3.10.2. This article was therefore written and tested against the release candidate: Maven 4.0.0-rc-7, JDK 25.0.5.1 (Temurin), Maven 3.9.16 for the Maven 3 comparisons, and mvnd 2.0.0-rc-3 (which embeds Maven 4.0.0-rc-3, not rc-7). Maven 4 needs Java 17 or newer to run; it can still compile for older targets. If 4.0.0 ships after this date, re-run scripts/run-all.sh and treat anything below that differs as news.

Why does Maven 4 need two POMs where Maven 3 had one?

In Maven 3 the file you edit and the file a consumer downloads are the same file. When you publish my-lib to a repository, Maven copies your pom.xml there as my-lib-1.0.pom, and every build that depends on my-lib downloads it and reads it. That single fact has quietly limited Maven for twenty years: the moment you add a new element to the POM format, every older Maven, every IDE and every vulnerability scanner that reads published POMs has to understand it too. Maven 4 breaks the link. It reads your pom.xml — the build POM — and at install or deploy time it generates a separate consumer POM from it. The consumer POM is the one published as my-lib-1.0.pom. Your original goes up as well, as my-lib-1.0-build.pom, for anyone who needs it. Because the two files are separate, the build POM is free to use a newer model version (4.1.0) while the consumer POM stays at 4.0.0, which every tool already understands.
pom.xml in your repo the build POM model 4.1.0 <parent/> <sources> <subprojects> root=”true” mvn install m4-lib-1.0.0-SNAPSHOT.pom the consumer POM (what other builds download) model 4.0.0, full parent coordinates, dependencies Maven 3, Gradle, scanners and IDEs can all read it m4-lib-1.0.0-SNAPSHOT-build.pom the build POM, kept alongside (classifier “build”) model 4.1.0, byte-for-byte your pom.xml only Maven 4 can read it You write one file. Consumers see another. That split is what lets 4.1.0 syntax exist without breaking Maven 3. Both files were captured from a real install, see output/03-lib-build-vs-consumer.txt.
The diagram shows one file going in and two coming out. The green file is the contract with the outside world and the amber file is yours. Keep that picture in mind, because three later sections are the same idea seen from different sides: what the consumer POM drops, what happens when Maven 3 meets each file, and what the upgrade tool changes in the amber one.

What does a Maven 4.1.0 project look like?

The smallest project that shows the split is a three-project reactor: a parent, a library and an application. The root POM is the first place the new model shows up. It declares root="true", the 4.1.0 namespace, and <subprojects>, which is the new name for <modules> (in Maven 4 vocabulary, “multi-module” has become “multi-project”). The version is ${revision}, supplied by .mvn/maven.config; Maven 4 resolves that placeholder when it generates the consumer POM, with no flatten plugin involved. Full file: reactor/pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<!-- BUILD POM. Model 4.1.0: only Maven 4 can read this file. -->
<project xmlns="http://maven.apache.org/POM/4.1.0" root="true">
  <modelVersion>4.1.0</modelVersion>

  <groupId>com.ankurm.m4</groupId>
  <artifactId>m4-demo</artifactId>
  <version>${revision}</version>
  <packaging>pom</packaging>

  <properties>
    <maven.compiler.release>21</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <!-- 4.1.0: <subprojects> replaces <modules> -->
  <subprojects>
    <subproject>bom</subproject>
    <subproject>lib</subproject>
    <subproject>app</subproject>
  </subprojects>
The library POM is where most of the 4.1.0 shorthand is. <parent/> is empty: Maven finds ../pom.xml and copies its coordinates. <sources> declares source directories in a form that replaces sourceDirectory and testSourceDirectory. The file is reactor/lib/pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0">
  <modelVersion>4.1.0</modelVersion>

  <parent/>

  <artifactId>m4-lib</artifactId>
  <packaging>jar</packaging>
And the build section, with <sources>, from the same file:
  <build>
    <!-- 4.1.0: <sources> replaces <sourceDirectory>/<testSourceDirectory> -->
    <sources>
      <source>
        <scope>main</scope>
        <directory>src/main/java</directory>
      </source>
      <source>
        <scope>test</scope>
        <directory>src/test/java</directory>
      </source>
    </sources>
  </build>
<packaging>bom</packaging> is the new way to say “this POM exists only to manage dependency versions”. The BOM subproject (reactor/bom/pom.xml) is tiny, and the application POM (reactor/app/pom.xml, dependency block below) shows the other inference feature: its dependency on the sibling m4-lib has no <version> at all.
  <dependencies>
    <!-- 4.1.0: no <version> needed for a sibling subproject -->
    <dependency>
      <groupId>com.ankurm.m4</groupId>
      <artifactId>m4-lib</artifactId>
    </dependency>
  </dependencies>
Build it with Maven 4. The transcript is output/02-reactor-build.txt; these are its key lines. Note the one-line notice about bom packaging, and that each project installs two POM files — the original with a -build suffix and a generated consumer-….pom that lands under the plain name.
$ mvn install
[INFO] The packaging attribute of the 'm4-bom' project is configured as 'bom' and changed to 'pom'
[INFO] Reactor Build Order:
[INFO] m4-demo                                                            [pom]
[INFO] m4-bom                                                             [pom]
[INFO] m4-lib                                                             [jar]
[INFO] m4-app                                                             [jar]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] Installing <module>/reactor/lib/target/m4-lib-1.0.0-SNAPSHOT.jar to <module>/.m2repo/com/ankurm/m4/m4-lib/1.0.0-SNAPSHOT/m4-lib-1.0.0-SNAPSHOT.jar
[INFO] Installing <module>/reactor/lib/pom.xml to <module>/.m2repo/com/ankurm/m4/m4-lib/1.0.0-SNAPSHOT/m4-lib-1.0.0-SNAPSHOT-build.pom
[INFO] Installing <module>/reactor/lib/target/consumer-2827804096093025405.pom to <module>/.m2repo/com/ankurm/m4/m4-lib/1.0.0-SNAPSHOT/m4-lib-1.0.0-SNAPSHOT.pom
[INFO] m4-demo ............................................ SUCCESS [ x.xxx s]
[INFO] m4-bom ............................................. SUCCESS [ x.xxx s]
[INFO] m4-lib ............................................. SUCCESS [ x.xxx s]
[INFO] m4-app ............................................. SUCCESS [ x.xxx s]
[INFO] BUILD SUCCESS
Going deeper: every model 4.1.0 addition, and which ones this article actually ran

Ran here (visible in the repo): root="true", <subprojects>, empty <parent/> inference, version-less sibling dependency, packaging bom, <sources>, and ${revision} without the flatten plugin.

Taken from Maven’s “What’s new in Maven 4” page and not run for this article, so treat them as documented intent rather than verified behaviour: condition-based profile activation (<condition> under <activation>), optional profiles with -P?name, the new dependency types (classpath-jar, modular-jar, processor and friends, which per the page only Maven Compiler Plugin 4.0.0-beta-3 or later understands), classified BOM imports, the ModelParser SPI for alternate POM syntaxes, --resume/-r semantics, the -b concurrent builder, and mvnenc password encryption.

Behaviour changes the same page lists that matter even if you adopt nothing: Plexus dependency injection is removed (plugins must use JSR-330), the Super POM’s default plugin versions changed, ${pom.*} expressions are removed, and deployAtEnd now defaults to true.

What exactly is in the consumer POM, and what was dropped?

Here is the library’s build POM compared with the consumer POM Maven 4 installed next to it. This is a real diff -u of the two installed files, from output/03-lib-build-vs-consumer.txt. Read it as “minus” lines being your 4.1.0 shorthand and “plus” lines being what Maven wrote for everyone else.
$ diff -u m4-lib-1.0.0-SNAPSHOT-build.pom m4-lib-1.0.0-SNAPSHOT.pom
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.1.0">
-  <modelVersion>4.1.0</modelVersion>
-
-  <parent/>
-
+<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>com.ankurm.m4</groupId>
+    <artifactId>m4-demo</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+  </parent>
   <artifactId>m4-lib</artifactId>
-  <packaging>jar</packaging>
-
   <dependencies>
     <dependency>
       <groupId>org.slf4j</groupId>
@@ -26,18 +26,4 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
-
-  <build>
-    <!-- 4.1.0: <sources> replaces <sourceDirectory>/<testSourceDirectory> -->
-    <sources>
-      <source>
-        <scope>main</scope>
-        <directory>src/main/java</directory>
-      </source>
-      <source>
-        <scope>test</scope>
-        <directory>src/test/java</directory>
-      </source>
-    </sources>
-  </build>
-</project>
+</project>
\ No newline at end of file
Three things happened. The namespace and model version went back to 4.0.0. The empty <parent/> was filled in with full coordinates — and notice the version there is 1.0.0-SNAPSHOT, not ${revision}, because Maven resolved it. And the whole <build> block, including <sources>, vanished, because source directories mean nothing to someone who only wants to depend on your jar. The application project shows the same thing for the version-less sibling dependency: the consumer POM spells out the version. File: output/04-app-and-bom-consumer-poms.txt.
$ cat m4-app-1.0.0-SNAPSHOT.pom   (consumer POM)
<?xml version="1.0" encoding="UTF-8"?>
<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>com.ankurm.m4</groupId>
    <artifactId>m4-demo</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>
  <artifactId>m4-app</artifactId>
  <dependencies>
    <dependency>
      <groupId>com.ankurm.m4</groupId>
      <artifactId>m4-lib</artifactId>
      <version>1.0.0-SNAPSHOT</version>
    </dependency>
  </dependencies>
</project>
One thing the default consumer POM does not do is become self-contained. It still points at the parent, so a consumer must be able to download the parent POM too; the root’s consumer POM in the same file keeps its <properties> and <pluginManagement>. If you want one file that stands alone, Maven 4 offers flattening, off by default:
$ mvn install -Dmaven.consumer.pom.flatten=true   (separate local repository)
[INFO] m4-demo ............................................ SUCCESS [ x.xxx s]
[INFO] m4-bom ............................................. SUCCESS [ x.xxx s]
[INFO] m4-lib ............................................. SUCCESS [ x.xxx s]
[INFO] m4-app ............................................. SUCCESS [ x.xxx s]
[INFO] BUILD SUCCESS
default consumer POM parent m4-demo:1.0.0-SNAPSHOT (kept) slf4j-api compile (kept) servlet-api provided (kept) junit test (kept) Consumers must be able to fetch the parent POM, and see test and provided dependencies listed. flattened (-Dmaven.consumer.pom.flatten=true) parent (gone, values merged in) slf4j-api compile (kept) servlet-api provided (dropped) junit test (dropped) Self-contained: one file describes the artifact. Off by default, so you opt in per build. Same library, same jar. The only difference is how much of your build the published POM exposes. Captured in output/04-app-and-bom-consumer-poms.txt (default) and output/07-flatten.txt (flattened).
The diagram contrasts the two variants for the same library. In the flattened POM the parent is gone and only the slf4j-api compile dependency is left; the provided servlet API and the test JUnit dependency disappeared. Here is the real flattened file, from output/07-flatten.txt:
<?xml version="1.0" encoding="UTF-8"?>
<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>
  <groupId>com.ankurm.m4</groupId>
  <artifactId>m4-lib</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>2.0.17</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
Check the build POM is actually published. Because the consumer POM drops <build>, anything a downstream tool needs from your build configuration has to be somewhere else. Two things in this run are worth knowing before you rely on flattening: the -build.pom sibling is still installed in the flattened case (see output/07-flatten.txt), and flattening removed the provided and test dependencies from what consumers see. If a downstream tool read those, it now will not.

Can Maven 3 users still depend on a library built with Maven 4?

This is the question that decides whether you can adopt Maven 4 in a library without an announcement. The answer has two halves, and the split is the whole point of the previous section. Half one: Maven 3 cannot build a 4.1.0 project. Point Maven 3.9.16 at the same reactor and it refuses before compiling anything. Both messages are quoted from output/05-maven3-reads-build-pom.txt:
$ mvn package   (Maven 3.9.16, same reactor)
[ERROR] Malformed POM <module>/reactor/pom.xml: Unknown attribute 'root' for tag 'project' (position: START_TAG seen ...->\n<project xmlns="http://maven.apache.org/POM/4.1.0" root="true">... @3:64)  @ <module>/reactor/pom.xml, line 3, column 64
[FATAL] 'modelVersion' of '4.1.0' is newer than the versions supported by this version of Maven: [4.0.0]. Building this project requires a newer version of Maven. @ line 4, column 17
Half two: Maven 3 can happily consume what Maven 4 publishes. The m3-consumer project is plain model 4.0.0 (m3-consumer/pom.xml) and depends on m4-app, which was published by the Maven 4 reactor. Maven 3.9.16 resolves it, walks the transitive dependency on m4-lib and slf4j-api, compiles against it, and the program runs. Transcript: output/06-maven3-consumes-consumer-pom.txt.
$ mvn dependency:tree   (Maven 3.9.16, model 4.0.0 project, depends on m4-app)
[INFO] ---------------------< com.ankurm.m3:m3-consumer >----------------------
[INFO] com.ankurm.m3:m3-consumer:jar:1.0.0
[INFO] \- com.ankurm.m4:m4-app:jar:1.0.0-SNAPSHOT:compile
[INFO]    \- com.ankurm.m4:m4-lib:jar:1.0.0-SNAPSHOT:compile
[INFO]       \- org.slf4j:slf4j-api:jar:2.0.17:compile
[INFO] BUILD SUCCESS
Hello, a Maven 3 consumer (built with Maven 4)
The program output on the last line, Hello, a Maven 3 consumer (built with Maven 4), comes from the library class reactor/lib/src/main/java/com/ankurm/m4/Greeter.java compiled by Maven 4 and loaded through a consumer POM that Maven 3 read without complaint. So: publishing from Maven 4 is safe for your downstream users, and building with Maven 4 is something every contributor and every CI job in your own project has to agree on.
QuestionAnswer in this runEvidence
Maven 3.9.16 builds a model 4.1.0 project?No: FATAL, “modelVersion of 4.1.0 is newer than the versions supported”output/05-maven3-reads-build-pom.txt
Maven 3.9.16 resolves a Maven 4-published library?Yes, including transitivesoutput/06-maven3-consumes-consumer-pom.txt
Maven 3.9.16 runs a POM that uses before:compile?Never gets that far: same 4.1.0 rejectionoutput/09-lifecycle-maven3.txt
  • Check which model version your published POMs have in a repository manager before and after the switch; the consumer POM should say 4.0.0 (output/03-lib-build-vs-consumer.txt)
  • Maven 3.10.2 is the newest Maven 3 on the download page; this article ran the Maven 3 comparisons on 3.9.16

What changes in the lifecycle: before: and after: phases

Maven’s lifecycle has always been a list of phases (compile, test, package…) and plugins bind goals to them. When you needed “just before compile” you bound to generate-sources or process-resources and hoped the ordering held. Maven 4 gives every phase a before: and an after: twin and lets you order several hooks inside one with a bracketed sort key such as before:package[100]. To see it, the lifecycle project binds the antrun plugin’s echo task to five of them. The POM is lifecycle/pom.xml and the relevant executions look like this.
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <id>before-compile</id>
            <phase>before:compile</phase>
            <goals><goal>run</goal></goals>
            <configuration><target><echo message="HOOK  before:compile"/></target></configuration>
          </execution>
          <execution>
            <id>after-compile</id>
            <phase>after:compile</phase>
            <goals><goal>run</goal></goals>
            <configuration><target><echo message="HOOK  after:compile"/></target></configuration>
          </execution>
          <execution>
            <id>before-package-first</id>
            <phase>before:package[100]</phase>
            <goals><goal>run</goal></goals>
            <configuration><target><echo message="HOOK  before:package[100]"/></target></configuration>
          </execution>
          <execution>
            <id>before-package-second</id>
            <phase>before:package[200]</phase>
            <goals><goal>run</goal></goals>
            <configuration><target><echo message="HOOK  before:package[200]"/></target></configuration>
          </execution>
          <execution>
            <id>after-clean</id>
            <phase>after:clean</phase>
            <goals><goal>run</goal></goals>
            <configuration><target><echo message="HOOK  after:clean"/></target></configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
Running mvn package and then mvn clean on Maven 4.0.0-rc-7 produced this order. Each HOOK line is one of the echo tasks. Full transcript: output/08-lifecycle-maven4.txt.
$ mvn package   (Maven 4)
[INFO] --- resources:3.3.1:resources (default-resources) @ lifecycle-demo ---
[WARNING]      [echo] HOOK  before:compile
[INFO] --- compiler:3.14.1:compile (default-compile) @ lifecycle-demo ---
[WARNING]      [echo] HOOK  after:compile
[INFO] --- resources:3.3.1:testResources (default-testResources) @ lifecycle-demo ---
[INFO] --- compiler:3.14.1:testCompile (default-testCompile) @ lifecycle-demo ---
[INFO] --- surefire:3.5.4:test (default-test) @ lifecycle-demo ---
[WARNING]      [echo] HOOK  before:package[100]
[WARNING]      [echo] HOOK  before:package[200]
[INFO] --- jar:3.4.2:jar (default-jar) @ lifecycle-demo ---
$ mvn clean   (Maven 4)
[INFO] --- clean:3.5.0:clean (default-clean) @ lifecycle-demo ---
[WARNING]      [echo] HOOK  after:clean
resourcesprocess-resources HOOKbefore:compile compiler:compilecompile HOOKafter:compile testResourcesprocess-test-res. before:package[100]runs first before:package[200]runs second jar:jarpackage clean:cleanclean after:cleanon mvn clean Amber boxes are hooks you add. A hook sits at a precise point between two existing steps, not just “somewhere in that phase”. Order shown is the order Maven 4.0.0-rc-7 printed, see output/08-lifecycle-maven4.txt.
The picture is that same transcript drawn left to right. before:compile fired after resources:resources and immediately before compiler:compile — that is, exactly where it says. The two before:package hooks ran in sort-key order, 100 then 200, before the jar was built. And after:clean ran as part of a plain mvn clean. That last one is a real behaviour change, not a detail. In Maven 3, mvn clean stops at the clean phase, so a plugin bound to post-clean does not run unless you ask for post-clean by name; the Maven 4 documentation says hooks around a major phase now always run, and the after:clean line above is that behaviour observed (I did not run the Maven 3 side). If you have pre-* or post-* bindings, the same page says they are deprecated aliases for the new names; that deprecation was not exercised here, so verify it on your own build.
Maven 3 never sees this. A POM with before:compile is a model 4.1.0 file as far as this article’s example goes, so Maven 3.9.16 stops at the model version before it ever reaches the phase name (output/09-lifecycle-maven3.txt). It does not say “unknown phase”. If you need a Maven 3-compatible build in the same repository, the new phase names are off the table.
Going deeper: the rest of the new lifecycle (documented, not run here)

The Maven 4 documentation describes the lifecycle as a tree rather than a flat list, which is what makes it possible to skip phases (deploy without install, for example). It adds all and each phases for whole-reactor and per-project wrapping, with before:all/after:all around a project’s subtree, and a -b concurrent builder for phase-level parallelism. The default builder behaves as in Maven 3. None of these were exercised in this article’s companion project; the transcripts cover before:/after: on single phases and the sort keys only. See the Maven 4 notes.

How do I upgrade an existing Maven 3 build, and what does mvnup change?

The migration path Maven ships is mvnup, the Maven Upgrade Tool in the bin directory of the 4.0.0-rc-7 distribution. To test it honestly I wrote a deliberately old-style project: model 4.0.0, <modules>, maven.compiler.source/target set to 17, ${pom.version} in a property, and no plugin versions pinned. It is the legacy-m3 directory (legacy-m3/pom.xml). Step one: does it build on Maven 4 untouched? Yes. Model 4.0.0 is still fully supported. But it is not quiet: Maven 4 now warns that the default plugin versions are unlocked, because the Super POM’s defaults changed. Look at the versions it picked (resources 3.5.0, compiler 3.16.0, surefire 3.6.0, jar 3.5.1): those are Maven 4.0.0-rc-7’s defaults, and they will move with each Maven release unless you pin them. I did not run the same project on Maven 3 to compare. Transcript output/10-legacy-on-maven4.txt:
$ mvn package   (Maven 4, untouched Maven 3 style project)
[WARNING] Version not locked for default bindings plugins [maven-resources-plugin, maven-compiler-plugin, maven-surefire-plugin, maven-jar-plugin], you should define versions in pluginManagement section of your pom.xml or parent
[INFO] --- resources:3.5.0:resources (default-resources) @ legacy-core ---
[INFO] --- compiler:3.16.0:compile (default-compile) @ legacy-core ---
[INFO] Compiling 1 source file with javac [debug target 17] to target/classes
[INFO] --- resources:3.5.0:testResources (default-testResources) @ legacy-core ---
[INFO] --- compiler:3.16.0:testCompile (default-testCompile) @ legacy-core ---
[INFO] --- surefire:3.6.0:test (default-test) @ legacy-core ---
[INFO] --- jar:3.5.1:jar (default-jar) @ legacy-core ---
[INFO] BUILD SUCCESS
The new --fail-on-severity (-fos) option turns that warning into a failing build, which is the cheapest way to make CI insist on pinned plugin versions. Every project in the reactor built, and Maven still returned failure (output/11-fail-on-severity.txt):
$ mvn -fos WARN package   (Maven 4: fail the build on any WARN)
[INFO] Enabled to break the build on log level WARN.
[INFO] legacy-parent ...................................... SUCCESS [ x.xxx s]
[INFO] legacy-core ........................................ SUCCESS [ x.xxx s]
[ERROR] BUILD FAILURE
[ERROR] Build failed due to log statements with a higher severity than allowed. Fix the logged issues or remove flag --fail-on-severity (-fos).
Step two: run the tool. mvnup check reports what it would do without touching files. Against this project it reported no changes required (output/12-mvnup-check.txt), which is consistent with model 4.0.0 being fine: the default check is about compatibility, not about adopting 4.1.0.
$ mvnup check
[INFO]   No POMs required modifications
mvnup apply --all is the option that adopts everything: model 4.1.0, inference, the fixes and plugin upgrades. Full transcript: output/13-mvnup-apply.txt. These are the interesting lines:
$ mvnup apply --all
[INFO]         ? Updated modelVersion to 4.1.0
[INFO]         ? Converted <modules> to <subprojects>
[INFO]         ? Converted 1 <module> elements to <subproject>
[INFO]         ? Updated modelVersion to 4.1.0
[INFO]       ? Removed: redundant subprojects list (matches direct children)
[INFO]       ? Removed: modelVersion element (can be inferred from namespace)
[INFO]       ? Removed: parent groupId (child has no explicit groupId)
[INFO]       ? Removed: parent version (child has no explicit version)
[INFO]       ? Removed: parent artifactId (can be inferred from relativePath)
[INFO]       ? Removed: modelVersion element (can be inferred from namespace)
[INFO]       ? Migrated properties: maven.compiler.source = maven.compiler.target = 17
[INFO]       ? Set targetVersion: 17
And here is what it did to the files, as a diff (output/14-mvnup-diff.txt):
$ diff -u legacy-m3/pom.xml (before) .../pom.xml (after)
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- A deliberately "Maven 3 style" project: model 4.0.0, <modules>, no plugin versions, ${pom.version}. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
+<project xmlns="http://maven.apache.org/POM/4.1.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>
+         xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 https://maven.apache.org/xsd/maven-4.1.0.xsd">
 
   <groupId>com.ankurm.legacy</groupId>
   <artifactId>legacy-parent</artifactId>
@@ -11,13 +10,16 @@
   <packaging>pom</packaging>
 
   <properties>
-    <maven.compiler.source>17</maven.compiler.source>
-    <maven.compiler.target>17</maven.compiler.target>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <banner>legacy ${pom.version}</banner>
   </properties>
 
-  <modules>
-    <module>core</module>
-  </modules>
+  <build>
+    <sources>
+      <source>
+        <targetVersion>17</targetVersion>
+      </source>
+    </sources>
+
+  </build>
 </project>
Most of that is welcome: the namespace moved to 4.1.0, <modules> became <subprojects> and then was removed as redundant (the module list matched the direct child directories), the child’s parent coordinates were inferred away. Two things are not welcome.
Trap: the Java target silently dropped from 17 to 8. The tool moved maven.compiler.source and maven.compiler.target out of <properties> and into <sources><source><targetVersion>17</targetVersion>. That is the new 4.1.0 spelling — but the default compiler plugin that Maven 4.0.0-rc-7 selected (3.16.0) did not read it. The next build compiled for Java 8:

[INFO] Compiling 1 source file with javac [debug target 1.8] to target/classes
[WARNING] source value 8 is obsolete and will be removed in a future release

Transcript output/15-upgraded-build.txt. Before the upgrade the same build said [debug target 17] (output/10-legacy-on-maven4.txt). The build still succeeded, which is exactly why this is dangerous: nothing fails, the bytecode is simply older than you intended. I observed this on every run of the companion script, with these specific versions; I did not test whether Maven Compiler Plugin 4.0.0-beta-3 or later reads <targetVersion>, which the Maven 4 page suggests is the plugin generation meant to understand the new elements. Until you have checked, diff your effective target version after running mvnup apply.
The second wrinkle is cosmetic: the child POM was left with an empty <parent></parent> split across two lines (visible in the diff above) rather than the <parent/> shorthand; Maven accepted it and the build above went through. ${pom.version} in the property was left untouched by the tool in this run (see the diff); the Maven 4 notes say ${pom.*} expressions are removed, and I did not run a build that depends on that expression, so check it yourself with a grep for ${pom. before you flip the switch.
Upgrade checklist (the ordered version)
  1. Decide what “done” means. As of 2026-11-26 Maven 4 is a release candidate (4.0.0-rc-7). A sensible bar is: Maven 3.9.x stays the CI default, Maven 4 runs in an extra, non-blocking CI job until GA.
  2. Check the JDK that runs Maven. Maven 4 needs Java 17 or later to run. Compile targets can still be older via maven.compiler.release or toolchains.
  3. Pin every plugin version in pluginManagement, including the default-bound ones (resources, compiler, surefire, jar, install, deploy, clean). Then run once with -fos WARN to prove nothing is unpinned (output/11-fail-on-severity.txt).
  4. Grep for removed expressions: ${pom. and for Plexus-style plugins (a plugin that uses Plexus DI needs a JSR-330 version).
  5. Run mvnup check in a copy of the repo, read what it proposes, then mvnup apply without --all first. Adopt model 4.1.0 only if every consumer of the build POM is Maven 4 (output/05-maven3-reads-build-pom.txt).
  6. After any apply, print the effective Java target and compare with before (output/15-upgraded-build.txt).
  7. Add a .mvn directory or root="true" at the repository root so Maven 4 knows where the root is; mvnup created .mvn itself in this run (output/13-mvnup-apply.txt).
  8. Publish to a scratch repository first and compare the consumer POM with the build POM (output/03-lib-build-vs-consumer.txt) before pushing to the real one.
  9. Decide on flattening per project; it is off by default and drops provided and test dependencies from the published view (output/07-flatten.txt).
  10. Update contributor docs and the Maven Wrapper so nobody builds a 4.1.0 POM with Maven 3 and gets the FATAL shown above.
Plugin compatibility: what actually ran on Maven 4.0.0-rc-7

These are only the plugins this project exercised, with the version Maven used and the file that shows it. “Ran” means the goal completed in that transcript; it is not a statement about every feature of the plugin.

PluginVersionResult on Maven 4.0.0-rc-7Evidence
maven-resources-plugin3.3.1 (pinned) and 3.5.0 (default)Ranoutput/02-reactor-build.txt, output/10-legacy-on-maven4.txt
maven-compiler-plugin3.14.1 (pinned) and 3.16.0 (default)Ran; 3.16.0 ignored <targetVersion> in this testoutput/15-upgraded-build.txt
maven-surefire-plugin3.5.4 (pinned) and 3.6.0 (default)Ran, JUnit 5 provider auto-detectedoutput/02-reactor-build.txt
maven-jar-plugin3.4.2 and 3.5.1Ranoutput/02-reactor-build.txt
maven-install-plugin3.1.4Ran; installs the -build.pom and consumer POMoutput/02-reactor-build.txt
maven-clean-plugin3.5.0Ran; after:clean hook firedoutput/08-lifecycle-maven4.txt
maven-antrun-plugin3.2.0Ran, bound to the new phasesoutput/08-lifecycle-maven4.txt

Not tested: deploy, shade, assembly, war, release, javadoc, failsafe, and any plugin that depends on Plexus injection. For those, mvnup claims to “upgrade plugins known to fail with Maven 4 to their minimum compatible versions” (its own help text, output/17-mvnup-help.txt); in this run its plugin-upgrade step reported nothing to change (output/13-mvnup-apply.txt).

Does mvnd change anything now that Maven 4 is here?

mvnd, the Maven Daemon, keeps a warm JVM between builds. It is a separate Apache project from Maven itself, and the Maven 4 documentation treats it that way. The version to know about is mvnd 2.0.0-rc-3, which is the Maven 4 line of the daemon — but it is not built on the same Maven as this article: mvnd --version reports it embeds Apache Maven 4.0.0-rc-3, four release candidates behind rc-7. The comparison I ran is deliberately narrow: the same reactor, the same pre-populated local repository, offline, tests skipped, one machine. Offline because mvnd resolves in parallel and the sandbox’s egress proxy answered HTTP 429 when it did; the offline run avoids measuring the proxy. Treat the numbers as indicative, not a benchmark. Transcript output/16-mvnd.txt:
$ mvnd --version
Apache Maven 4.0.0-rc-3 (3952d00ce65df6753b63a51e86b1f626c55a8df2)
$ mvnd -o -DskipTests install   (daemon starting)
[INFO] BUILD SUCCESS
wall: 11.646 s
$ mvnd -o -DskipTests install   (daemon already running)
[INFO] BUILD SUCCESS
wall: 3.625 s
$ mvn -o -DskipTests install   (plain Maven 4.0.0-rc-7, new JVM each time)
[INFO] BUILD SUCCESS
wall: 8.670 s
[INFO] BUILD SUCCESS
wall: 13.017 s
The first mvnd build includes starting the daemon; the second one reuses it and finished in roughly a third to a quarter of the time of plain Maven 4 here. That is the win — it comes from not paying JVM startup and class loading again, not from anything Maven 4 added. If your builds are dominated by compilation and tests rather than by Maven’s own start-up, expect much less.
Mixing versions is easy to do by accident. If you install mvnd to try Maven 4, your build runs on the Maven version inside the mvnd distribution, which can differ from the mvn on your PATH or the one your CI uses. In this run: mvnd with Maven 4.0.0-rc-3, mvn with 4.0.0-rc-7. Print the version in both before you compare results.

Should you move to Maven 4 today?

An honest answer: not as your only build tool, and not yet for production releases. The thing everyone wants to hear — “Maven 4 is out” — is not true on 2026-11-26. It is at its seventh release candidate. Apache’s own download page marks it not safe for production and recommends Maven 3.10.2. The case for starting now is narrow and real: you maintain a library, you want to know whether your plugins work, and you can run Maven 4 as an additional CI job without letting it publish. The case against is also concrete: model 4.1.0 files cannot be built by Maven 3, so the day you adopt <subprojects> or <sources>, every contributor needs Maven 4. If you do nothing else, pin your plugin versions and add -fos WARN to a CI job; that work pays off on Maven 3 and Maven 4 alike. And re-read the Maven download page before you act on anything here, because the status of 4.0.0 is the single fact in this article most likely to change.
Production checklist
  • Status gate: check maven-metadata.xml for apache-maven and the Apache download page; do not ship releases from a release candidate (output/01-versions.txt).
  • Two builds in CI: Maven 3.9.x or 3.10.x as the gate, Maven 4 as an informational job until GA.
  • Wrapper: pin the Maven version in .mvn/wrapper/maven-wrapper.properties so a 4.1.0 POM is never opened by an older Maven by accident.
  • Published artifacts: after the first Maven 4 deploy, download the .pom from your repository manager and confirm <modelVersion>4.0.0</modelVersion> (output/03-lib-build-vs-consumer.txt).
  • Flattening decision recorded per module, with a note on provided/test dependencies (output/07-flatten.txt).
  • Effective Java target checked after every mvnup apply (output/15-upgraded-build.txt).
  • Plugins pinned, and -fos WARN in CI (output/11-fail-on-severity.txt).
  • Daemon: if you use mvnd, record which embedded Maven version it runs (output/16-mvnd.txt).
  • Rollback plan: keep a branch with the 4.0.0 POMs and the Maven 3 wrapper until Maven 4.0.0 GA plus a patch release.

Further reading

No Comments yet!

This site uses Akismet to reduce spam. Learn how your comment data is processed.