Class ToolchainPluginStrategy
java.lang.Object
org.apache.maven.cling.invoker.mvnup.goals.AbstractUpgradeStrategy
org.apache.maven.cling.invoker.mvnup.goals.ToolchainPluginStrategy
- All Implemented Interfaces:
UpgradeStrategy
@Named
@Singleton
@Priority(15)
public class ToolchainPluginStrategy
extends AbstractUpgradeStrategy
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).
This strategy is independent of the JDK used to run mvnup: it acts purely on
what the project declares. A project targeting --source 6 needs the
toolchain plugin regardless of whether mvnup is invoked under JDK 11 or JDK 25.
This strategy detects the project's source level from:
maven.compiler.releasepropertymaven.compiler.sourceproperty- Compiler plugin
<configuration><release>or<source>
If the declared source level is retired (i.e. no longer accepted by the latest JDK)
and the maven-toolchains-plugin is not already configured with the
select-jdk-toolchain goal, this strategy adds it so that the plugin's built-in
JDK discovery mechanism can find a compatible JDK at build time.
- 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
-
ToolchainPluginStrategy
public ToolchainPluginStrategy()
-
-
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
-