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 upgradesApply
- Applies upgrades to project filesHelp
- Displays usage information
Upgrade Strategies
The tool uses a strategy pattern to handle different types of upgrades:
ModelUpgradeStrategy
- Upgrades POM model versions (4.0.0 → 4.1.0)PluginUpgradeStrategy
- Upgrades plugin versions for Maven 4 compatibilityInferenceStrategy
- Applies Maven 4.1.0+ inference optimizationsCompatibilityFixStrategy
- Fixes Maven 4 compatibility issues
Utility Classes
StrategyOrchestrator
- Coordinates strategy executionPomDiscovery
- Discovers POM files in multi-module projectsJDomUtils
- XML manipulation utilities
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:
- Implement
UpgradeStrategy
- Optionally extend
AbstractUpgradeStrategy
- Annotate with
@Named
and@Singleton
- Use
@Priority
to control execution order
- Since:
- 4.0.0
-
ClassDescriptionBase 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.Represents a Maven GAV (GroupId, ArtifactId, Version) coordinate.Utility class for handling GroupId, ArtifactId, Version (GAV) operations in Maven POM files during the upgrade process.The "help" goal implementation.Strategy for applying Maven inference optimizations.Utility class for JDOM operations.Strategy for upgrading Maven model versions (e.g., 4.0.0 → 4.1.0).Utility class for handling Maven model version operations during upgrades.Plugin upgrade configuration for Maven 4 compatibility.Strategy for upgrading Maven plugins to recommended versions.Holds plugin upgrade information for Maven 4 compatibility.Utility class for discovering and loading POM files in a Maven project hierarchy.Orchestrates the execution of different upgrade strategies.Constants used throughout the Maven upgrade tools.Common file and directory names.Common indentation patterns for XML formatting.Maven model version constants.Maven namespace constants.Common Maven plugin constants.Schema location constants.XML attribute constants.Common XML element names used in Maven POMs.Result of an upgrade strategy application.Strategy interface for different types of upgrade operations.