Wait no more, here comes Maven 4! by Robert Scholte, Maarten Mulders

Discover what's new in Maven 4: Java 17 requirement, immutable project model, BOM packaging, build/consumer POM separation, and improved multi-module project handling.

Key takeaways
  • Maven 4.0 requires Java 17 to run, but can still compile code targeting older Java versions through toolchains

  • The project model becomes immutable in Maven 4, preventing modifications after initial loading

  • New BOM (Bill of Materials) packaging type introduced to better manage dependency versions across projects

  • Build/Consumer POM separation introduced - build POM contains full build configuration while consumer POM only has dependencies

  • Project Local Repository introduced to cache project artifacts separately from the user’s local repository

  • Command line argument changes:

    • New -ps flag for project-specific settings
    • Resume from functionality simplified
    • Several deprecated flags removed
  • Default plugin versions no longer bundled - must be explicitly specified in projects

  • New lifecycle phases added with pre/post variants for better build control

  • Fail-on-severity flag introduced to control build failure based on logging levels

  • Improved handling of multi-module projects:

    • Better module ordering
    • Clearer distinction between public and implementation modules
    • Enhanced version management across modules
  • Migration expected to be smooth - existing Maven 3 projects should work on Maven 4 with minimal changes

  • Performance improvements through Java 17 features and internal optimizations