Now that there is release candidate 2 of Maven 4.0.0 and things become more stable, I would like to know:
What are the main differences between Maven 3.x and 4.0.0 for Maven users (and Maven plugin developers)?
I tried to have a look at release notes and the Maven homepage, but I am a bit overwhelmed. A lot information is about the internal structure of Maven, and there is a huge number of issues in the issue tracker that are resolved, but I did find any good information that summarizes the main improvements and breaking changes.
Main points are:
4.0.0
bom
for Bills of Materials.See also https://maven.apache.org/whatsnewinmaven4.html, thanks to Karl-Heinz Marbaise for the link.
The https://maven.apache.org/whatsnewinmaven4.html is the main source.
Note that it is not finalized before Maven 4.0 release.
I would summarize as follows:
Java 17 as minimum to run maven mvn
/mvnd
concurrent builder ( not default, used by passing -b concurrent
),
this in turn enables lifecycle phases to be as tree vs as sequence as it was in maven 3 and still Maven 4.0 default for compatibility.
(maven) subprojects is new name for maven modules,
in order not to confuse with Java modules,
but you don't need to update your pom.xml
Note that maven model version was 4.0 in maven 3.x, that may cause some confusions
New model version 4.1 can optionally be used for:
All core plugins updated to 4.x version
Note that maven was and still is recommending to specify exact every plugin version used, so upgrading existing project would need to updates those version in pom.xml
, but what is usually takes longer is all secondary and "outside-The-Maven-Land" plugins to be updated and fully compatible with 4.x
Some "(very) old Maven plugins that have not been updated to use the recommended APIs" will stop working, i.e. Maven 4.0 drops some outdated plugin support.
But usually you should see warnings for those plugins,
especially when running Maven 3.9.x
There is extensive guide on how to Migrate to Maven 4.
For existing projects it is recommend first using Maven 3.9.x and checking all plugins updates mvn versions:display-plugin-updates
.
P.S. The answer will be updated after 4.0 is finally released. Usually around that time there are review in Internet giving highlights and example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With