Package org.apache.maven.cling.invoker.mvnup.goals


package org.apache.maven.cling.invoker.mvnup.goals
Maven Upgrade Tool Goals and Strategies.

This package contains the implementation of the Maven upgrade tool (mvnup) that helps upgrade Maven projects to be compatible with Maven 4. The tool is organized around a goal-based architecture with pluggable upgrade strategies.

Architecture Overview

Goals

  • Check - Analyzes projects and reports needed upgrades
  • Apply - Applies upgrades to project files
  • Help - Displays usage information

Upgrade Strategies

The tool uses a strategy pattern to handle different types of upgrades:

Utility Classes

Usage Examples

Check for Available Upgrades

mvnup check

Apply All Upgrades

mvnup apply --all

Upgrade to Maven 4.1.0 with Inference

mvnup apply --model 4.1.0 --infer

Extension Points

To add new upgrade strategies:

  1. Implement UpgradeStrategy
  2. Optionally extend AbstractUpgradeStrategy
  3. Annotate with @Named and @Singleton
  4. Use @Priority to control execution order
Since:
4.0.0
  • Class
    Description
    Base class for upgrade goals containing shared functionality.
    Abstract base class for upgrade strategies that provides common functionality and reduces code duplication across strategy implementations.
    The "apply" goal implementation.
    The "check" goal implementation.
    Strategy for applying Maven 4 compatibility fixes to POM files.
    Strategy for deduplicating dependency and plugin declarations in POM files.
    Utility class for XML operations on Maven POM files.
    Strategy for removing duplicate XML elements in POM files.
    Strategy for widening requireMavenVersion ranges in the maven-enforcer-plugin to allow Maven 4.
    The "help" goal implementation.
    Strategy for applying Maven inference optimizations.
    Strategy for upgrading Maven model versions (e.g., 4.0.0 → 4.1.0).
    Utility class for handling Maven model version operations during upgrades.
    Strategy for fixing invalid Automatic-Module-Name manifest entries in POM files.
    Strategy for injecting the standalone OpenJDK Nashorn engine as a plugin dependency when maven-antrun-plugin uses inline JavaScript via <script language="javascript">.
    Plugin migration configuration for Maven 4 compatibility.
    Plugin upgrade configuration for Maven 4 compatibility.
    Strategy for upgrading Maven plugins to recommended versions.
    Holds plugin upgrade information for Maven 4 compatibility.
    Discovers and loads Maven POM files in a Maven project hierarchy.
    Strategy for upgrading HTTP repository URLs to HTTPS in POM files.
    Strategy for adding binary file extension exclusions to the maven-resources-plugin when resource filtering is enabled.
    Strategy for migrating legacy source configuration to Maven 4.1.0+ <source> elements.
    domtrip-based orchestrator for executing different upgrade strategies.
    Strategy for adding the maven-toolchains-plugin with the select-jdk-toolchain goal when the project's declared --source/--release level has been retired by a newer JDK (per JEP 182).
    Result of an upgrade strategy application.
    Strategy interface for different types of upgrade operations.