Class ModuleNameFixStrategy
- All Implemented Interfaces:
UpgradeStrategy
Automatic-Module-Name manifest entries in POM files.
Java module names (as validated by SourceVersion.isName(CharSequence)) must be
dot-separated sequences of valid Java identifiers. Dashes (-) are the most common
illegal character because Maven artifact IDs conventionally use them, and projects often
copy the artifact ID into the Automatic-Module-Name manifest entry without
sanitizing it.
Since maven-archiver 3.3.0
(MSHARED-773),
the archiver validates Automatic-Module-Name entries and fails the build on
invalid names. When mvnup upgrades maven-jar-plugin (or other packaging
plugins) to versions that pull in the newer archiver, previously-unchecked invalid names
surface as build failures.
This strategy scans all packaging plugin configurations for
<archive><manifestEntries><Automatic-Module-Name> elements whose values
contain dashes, and replaces the dashes with dots to produce a valid module name.
- See Also:
-
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, computeAllArtifactCoordinates, extractArtifactCoordinatesWithParentResolution, findCommonRoot, getOptions, getSession, logSummary, remoteResolutionUnsupportedReasonMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface UpgradeStrategy
isOptionEnabled
-
Constructor Details
-
ModuleNameFixStrategy
public ModuleNameFixStrategy()
-
-
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
-