Package org.apache.maven.plugin.internal
Class PluginDependencyResolutionListener
- java.lang.Object
-
- org.apache.maven.plugin.internal.PluginDependencyResolutionListener
-
- All Implemented Interfaces:
ResolutionListener
class PluginDependencyResolutionListener extends java.lang.Object implements ResolutionListener
Assists in detecting wagon providers brought into the plugin class path via legacy Maven core artifacts (e.g. maven-core:2.0.6) and excluding them. A plugin should be able to explicitly declare dependencies on specific wagons for its use. However, the (old) wagons pulled in transitively via legacy Maven core artifacts are usually not intended as dependencies and more importantly screw up artifact resolution because they would get preferred over the core wagon versions. This is a hack to provide backward-compat with Maven 2 (MNG-4528, MNG-4561).- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<Artifact,java.lang.Object>
bannedArtifacts
private java.util.LinkedList<Artifact>
coreArtifacts
private ArtifactFilter
coreFilter
private Artifact
wagonProvider
-
Fields inherited from interface org.apache.maven.artifact.resolver.ResolutionListener
FINISH_PROCESSING_CHILDREN, INCLUDE_ARTIFACT, MANAGE_ARTIFACT, MANAGE_ARTIFACT_SCOPE, MANAGE_ARTIFACT_SYSTEM_PATH, MANAGE_ARTIFACT_VERSION, OMIT_FOR_CYCLE, OMIT_FOR_NEARER, PROCESS_CHILDREN, RESTRICT_RANGE, ROLE, SELECT_VERSION_FROM_RANGE, TEST_ARTIFACT, UPDATE_SCOPE, UPDATE_SCOPE_CURRENT_POM
-
-
Constructor Summary
Constructors Constructor Description PluginDependencyResolutionListener(ArtifactFilter coreFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endProcessChildren(Artifact artifact)
void
includeArtifact(Artifact artifact)
private boolean
isLegacyCoreArtifact(Artifact artifact)
private boolean
isWagonProvider(Artifact artifact)
void
manageArtifact(Artifact artifact, Artifact replacement)
void
omitForCycle(Artifact artifact)
void
omitForNearer(Artifact omitted, Artifact kept)
void
removeBannedDependencies(java.util.Collection<Artifact> artifacts)
void
restrictRange(Artifact artifact, Artifact replacement, VersionRange newRange)
void
selectVersionFromRange(Artifact artifact)
void
startProcessChildren(Artifact artifact)
void
testArtifact(Artifact node)
void
updateScope(Artifact artifact, java.lang.String scope)
void
updateScopeCurrentPom(Artifact artifact, java.lang.String ignoredScope)
This event means that the artifactScope has NOT been updated to a farther node artifactScope because current node is in the first level pom
-
-
-
Field Detail
-
coreFilter
private ArtifactFilter coreFilter
-
coreArtifacts
private java.util.LinkedList<Artifact> coreArtifacts
-
wagonProvider
private Artifact wagonProvider
-
bannedArtifacts
private java.util.Map<Artifact,java.lang.Object> bannedArtifacts
-
-
Constructor Detail
-
PluginDependencyResolutionListener
PluginDependencyResolutionListener(ArtifactFilter coreFilter)
-
-
Method Detail
-
removeBannedDependencies
public void removeBannedDependencies(java.util.Collection<Artifact> artifacts)
-
startProcessChildren
public void startProcessChildren(Artifact artifact)
- Specified by:
startProcessChildren
in interfaceResolutionListener
-
isLegacyCoreArtifact
private boolean isLegacyCoreArtifact(Artifact artifact)
-
endProcessChildren
public void endProcessChildren(Artifact artifact)
- Specified by:
endProcessChildren
in interfaceResolutionListener
-
includeArtifact
public void includeArtifact(Artifact artifact)
- Specified by:
includeArtifact
in interfaceResolutionListener
-
isWagonProvider
private boolean isWagonProvider(Artifact artifact)
-
manageArtifact
public void manageArtifact(Artifact artifact, Artifact replacement)
- Specified by:
manageArtifact
in interfaceResolutionListener
-
omitForCycle
public void omitForCycle(Artifact artifact)
- Specified by:
omitForCycle
in interfaceResolutionListener
-
omitForNearer
public void omitForNearer(Artifact omitted, Artifact kept)
- Specified by:
omitForNearer
in interfaceResolutionListener
-
restrictRange
public void restrictRange(Artifact artifact, Artifact replacement, VersionRange newRange)
- Specified by:
restrictRange
in interfaceResolutionListener
-
selectVersionFromRange
public void selectVersionFromRange(Artifact artifact)
- Specified by:
selectVersionFromRange
in interfaceResolutionListener
-
testArtifact
public void testArtifact(Artifact node)
- Specified by:
testArtifact
in interfaceResolutionListener
-
updateScope
public void updateScope(Artifact artifact, java.lang.String scope)
- Specified by:
updateScope
in interfaceResolutionListener
-
updateScopeCurrentPom
public void updateScopeCurrentPom(Artifact artifact, java.lang.String ignoredScope)
Description copied from interface:ResolutionListener
This event means that the artifactScope has NOT been updated to a farther node artifactScope because current node is in the first level pom- Specified by:
updateScopeCurrentPom
in interfaceResolutionListener
- Parameters:
artifact
- current node artifact, the one in the first level pomignoredScope
- artifactScope that was ignored because artifact was in first level pom
-
-