The Current State of Apache Maven 4 - Development by Karl Heinz Marbaise

Learn about Maven 4's architectural changes, new features & improvements: JDK 17 requirement, separated POM types, enhanced lifecycle control, and better performance.

Key takeaways
  • Maven 4 introduces separation between build POM and consumer POM to better serve different purposes

    • Build POM contains full build configuration
    • Consumer POM contains only dependencies and minimal info needed for consumption
  • Minimum JDK requirement for Maven 4 is Java 17

  • Major architectural changes:

    • Removed old Plexus dependency injection
    • New native HTTP resolver
    • Removed wagon transport system
    • Updated to Eclipse Aether 2.x resolver
  • New lifecycle phases and improved control:

    • Before/after phases replace pre/post phases
    • Better control over plugin execution order
    • Simplified integration test phases
  • New features in Maven 4:

    • Better BOM packaging support
    • Extension configuration in XML
    • Improved plugin validation
    • New CLI for password management
    • Color output support
  • Performance improvements:

    • Faster bootstrap time
    • Improved dependency resolution
    • Better module handling for large multi-module projects
  • Backwards compatibility:

    • POM format remains XML-based for tool compatibility
    • Maintains model version 4.0 compatibility
    • Plugins need updates for Maven 4 API
  • Configuration changes:

    • New .mvn directory for project configuration
    • Support for project-specific extension settings
    • Improved toolchain support
  • Cleaner architecture:

    • Separated core components
    • Removed duplicate functionality
    • Better component reuse
  • Focus on correct implementation over performance in beta phase