Package org.openrewrite.maven
Class MavenVisitor<P>
java.lang.Object
org.openrewrite.TreeVisitor<org.openrewrite.xml.tree.Xml,P>
org.openrewrite.xml.XmlVisitor<P>
org.openrewrite.maven.MavenVisitor<P>
- Direct Known Subclasses:
MavenIsoVisitor
,UpdateMavenModel
public class MavenVisitor<P>
extends org.openrewrite.xml.XmlVisitor<P>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondownloadMetadata
(String groupId, String artifactId, @Nullable ResolvedPom containingPom, org.openrewrite.ExecutionContext ctx) downloadMetadata
(String groupId, String artifactId, org.openrewrite.ExecutionContext ctx) findDependencies
(String groupId, String artifactId) Finds dependencies in the model that match the provided group and artifact ids.findDependencies
(Predicate<ResolvedDependency> matcher) Finds dependencies in the model that match the given predicate.@Nullable ResolvedDependency
findDependency
(org.openrewrite.xml.tree.Xml.Tag tag) @Nullable ResolvedDependency
findDependency
(org.openrewrite.xml.tree.Xml.Tag tag, @Nullable Scope inClasspathOf) @Nullable ResolvedManagedDependency
findManagedDependency
(String groupId, String artifactId) @Nullable ResolvedManagedDependency
findManagedDependency
(org.openrewrite.xml.tree.Xml.Tag tag) @Nullable ResolvedManagedDependency
findManagedDependency
(org.openrewrite.xml.tree.Xml.Tag tag, @Nullable Scope inClasspathOf) @Nullable Plugin
findManagedPlugin
(org.openrewrite.xml.tree.Xml.Tag tag) @Nullable Plugin
findPlugin
(org.openrewrite.xml.tree.Xml.Tag tag) protected MavenResolutionResult
boolean
isAcceptable
(org.openrewrite.SourceFile sourceFile, P p) boolean
Does the current tag can contain groupId, artifactId and version?boolean
boolean
isDependencyTag
(String groupId, String artifactId) Is a tag a dependency that matches the group and artifact?boolean
isManagedDependencyImportTag
(String groupId, String artifactId) boolean
boolean
isManagedDependencyTag
(String groupId, String artifactId) Is a tag a managed dependency that matches the group and artifact?boolean
boolean
boolean
isPluginDependencyTag
(String groupId, String artifactId) boolean
boolean
isPluginTag
(String groupId, @Nullable String artifactId) boolean
boolean
void
Methods inherited from class org.openrewrite.xml.XmlVisitor
autoFormat, autoFormat, autoFormat, maybeAutoFormat, maybeAutoFormat, maybeAutoFormat, visitAttribute, visitAttributeValue, visitCharData, visitComment, visitDocTypeDecl, visitDocTypeDeclExternalSubsets, visitDocument, visitElement, visitIdent, visitJspDirective, visitProcessingInstruction, visitProlog, visitTag, visitTagClosing, visitXmlDecl
Methods inherited from class org.openrewrite.TreeVisitor
adapt, collect, collect, defaultValue, doAfterVisit, getAfterVisit, getCursor, isAdaptableTo, noop, postVisit, preVisit, reduce, reduce, reduce, setCursor, stopAfterPreVisit, updateCursor, visit, visit, visit, visitAndCast, visitAndCast, visitMarker, visitMarkers, visitNonNull, visitNonNull, visitorTreeType
-
Constructor Details
-
MavenVisitor
public MavenVisitor()
-
-
Method Details
-
getLanguage
- Overrides:
getLanguage
in classorg.openrewrite.xml.XmlVisitor<P>
-
isAcceptable
- Overrides:
isAcceptable
in classorg.openrewrite.xml.XmlVisitor<P>
-
getResolutionResult
-
isPropertyTag
public boolean isPropertyTag() -
isDependencyTag
public boolean isDependencyTag() -
isDependencyTag
Is a tag a dependency that matches the group and artifact?- Parameters:
groupId
- The group ID glob expression to compare the tag against.artifactId
- The artifact ID glob expression to compare the tag against.- Returns:
- true if the tag matches.
-
isPluginDependencyTag
-
isManagedDependencyTag
public boolean isManagedDependencyTag() -
isManagedDependencyTag
Is a tag a managed dependency that matches the group and artifact?- Parameters:
groupId
- The group ID glob expression to compare the tag against.artifactId
- The artifact ID glob expression to compare the tag against.- Returns:
- true if the tag matches.
-
isManagedDependencyImportTag
-
maybeUpdateModel
public void maybeUpdateModel() -
isPluginTag
public boolean isPluginTag() -
isPluginTag
-
isManagedPluginTag
public boolean isManagedPluginTag() -
isParentTag
public boolean isParentTag() -
isProjectTag
public boolean isProjectTag() -
findDependency
-
findManagedDependency
public @Nullable ResolvedManagedDependency findManagedDependency(org.openrewrite.xml.tree.Xml.Tag tag) -
findManagedDependency
-
findManagedDependency
public @Nullable ResolvedManagedDependency findManagedDependency(org.openrewrite.xml.tree.Xml.Tag tag, @Nullable Scope inClasspathOf) -
findDependency
public @Nullable ResolvedDependency findDependency(org.openrewrite.xml.tree.Xml.Tag tag, @Nullable Scope inClasspathOf) -
findDependencies
Finds dependencies in the model that match the provided group and artifact ids.Note: The list may contain the same dependency multiple times, if it is present in multiple scopes.
- Parameters:
groupId
- The groupId to matchartifactId
- The artifactId to match.- Returns:
- dependencies (including transitive dependencies) with any version matching the provided group and artifact id, if any.
-
findDependencies
Finds dependencies in the model that match the given predicate.- Parameters:
matcher
- A dependency test- Returns:
- dependencies (including transitive dependencies) with any version matching the given predicate.
-
downloadMetadata
public MavenMetadata downloadMetadata(String groupId, String artifactId, org.openrewrite.ExecutionContext ctx) throws MavenDownloadingException - Throws:
MavenDownloadingException
-
downloadMetadata
public MavenMetadata downloadMetadata(String groupId, String artifactId, @Nullable ResolvedPom containingPom, org.openrewrite.ExecutionContext ctx) throws MavenDownloadingException - Throws:
MavenDownloadingException
-
isDependencyLikeTag
public boolean isDependencyLikeTag()Does the current tag can contain groupId, artifactId and version? -
findPlugin
-
findManagedPlugin
-