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
Constructors -
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) downloadPluginMetadata(String groupId, String artifactId, @Nullable ResolvedPom containingPom, org.openrewrite.ExecutionContext ctx) downloadPluginMetadata(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 ResolvedDependencyfindDependency(org.openrewrite.xml.tree.Xml.Tag tag) @Nullable ResolvedDependencyfindDependency(org.openrewrite.xml.tree.Xml.Tag tag, @Nullable Scope inClasspathOf) @Nullable ResolvedManagedDependencyfindManagedDependency(String groupId, String artifactId) @Nullable ResolvedManagedDependencyfindManagedDependency(org.openrewrite.xml.tree.Xml.Tag tag) @Nullable ResolvedManagedDependencyfindManagedDependency(org.openrewrite.xml.tree.Xml.Tag tag, @Nullable Scope inClasspathOf) @Nullable PluginfindManagedPlugin(org.openrewrite.xml.tree.Xml.Tag tag) @Nullable PluginfindPlugin(org.openrewrite.xml.tree.Xml.Tag tag) protected org.openrewrite.maven.tree.MavenResolutionResultbooleanisAcceptable(org.openrewrite.SourceFile sourceFile, P p) booleanDoes the current tag can contain groupId, artifactId and version?booleanbooleanisDependencyTag(String groupId, String artifactId) Is a tag a dependency that matches the group and artifact?booleanisManagedDependencyImportTag(String groupId, String artifactId) booleanbooleanisManagedDependencyTag(String groupId, String artifactId) Is a tag a managed dependency that matches the group and artifact?booleanbooleanbooleanisPluginDependencyTag(String groupId, String artifactId) booleanbooleanisPluginTag(String groupId, @Nullable String artifactId) booleanbooleanvoidMethods 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, visitXmlDeclMethods 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:
getLanguagein classorg.openrewrite.xml.XmlVisitor<P>
-
isAcceptable
- Overrides:
isAcceptablein classorg.openrewrite.xml.XmlVisitor<P>
-
getResolutionResult
protected org.openrewrite.maven.tree.MavenResolutionResult 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
-
downloadPluginMetadata
public MavenMetadata downloadPluginMetadata(String groupId, String artifactId, org.openrewrite.ExecutionContext ctx) throws MavenDownloadingException - Throws:
MavenDownloadingException
-
downloadPluginMetadata
public MavenMetadata downloadPluginMetadata(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
-