Class EnforcerVersionRangeStrategy
java.lang.Object
org.apache.maven.cling.invoker.mvnup.goals.AbstractUpgradeStrategy
org.apache.maven.cling.invoker.mvnup.goals.EnforcerVersionRangeStrategy
- All Implemented Interfaces:
UpgradeStrategy
@Named
@Singleton
@Priority(18)
public class EnforcerVersionRangeStrategy
extends AbstractUpgradeStrategy
Strategy for widening
requireMavenVersion ranges in the maven-enforcer-plugin
to allow Maven 4.
Many projects use the maven-enforcer-plugin with a requireMavenVersion rule
that has an exclusive upper bound at version 4 (e.g., [3.8.8,4), [3,4)),
which blocks Maven 4 builds. This strategy widens such ranges to allow Maven 4 by changing
the upper bound to 5 (e.g., [3.8.8,4) becomes [3.8.8,5)).
The strategy handles:
<configuration><rules><requireMavenVersion>in plugin declarations<executions><execution><configuration><rules><requireMavenVersion>in executions- Both
build/pluginsandbuild/pluginManagement/pluginssections - Profile-scoped enforcer plugin declarations
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected UpgradeResultdoApply(UpgradeContext context, Map<Path, eu.maveniverse.domtrip.Document> pomMap) Subclasses implement the actual upgrade logic here.Gets a description of what this strategy does.booleanisApplicable(UpgradeContext context) Checks if this strategy is applicable given the current options.Methods inherited from class AbstractUpgradeStrategy
apply, buildEffectiveModel, cleanupTempDirectory, computeAllArtifactCoordinates, createTempProjectStructure, extractArtifactCoordinatesWithParentResolution, findCommonRoot, getOptions, getSession, logSummaryMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface UpgradeStrategy
isOptionEnabled
-
Constructor Details
-
EnforcerVersionRangeStrategy
public EnforcerVersionRangeStrategy()
-
-
Method Details
-
isApplicable
Description copied from interface:UpgradeStrategyChecks if this strategy is applicable given the current options.- Parameters:
context- the upgrade context- Returns:
- true if this strategy should be applied
-
getDescription
Description copied from interface:UpgradeStrategyGets a description of what this strategy does.- Returns:
- a human-readable description of the strategy
-
doApply
protected UpgradeResult doApply(UpgradeContext context, Map<Path, eu.maveniverse.domtrip.Document> pomMap) Description copied from class:AbstractUpgradeStrategySubclasses implement the actual upgrade logic here.- Specified by:
doApplyin classAbstractUpgradeStrategy- Parameters:
context- the upgrade contextpomMap- map of all POM files in the project- Returns:
- the result of the upgrade operation
-