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, 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) protected MavenResolutionResultbooleanisAcceptable(org.openrewrite.SourceFile sourceFile, P p) 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?booleanbooleanbooleanisPluginTag(String groupId, @Nullable String artifactId) booleanvoidMethods inherited from class org.openrewrite.xml.XmlVisitor
autoFormat, autoFormat, autoFormat, maybeAutoFormat, maybeAutoFormat, maybeAutoFormat, visitAttribute, visitCharData, visitComment, visitDocTypeDecl, visitDocument, visitElement, visitIdent, visitProcessingInstruction, visitProlog, visitTag, 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
-
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.
-
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
-
isParentTag
public boolean isParentTag() -
findDependency
-
findManagedDependency
@Nullable public @Nullable ResolvedManagedDependency findManagedDependency(org.openrewrite.xml.tree.Xml.Tag tag) -
findManagedDependency
@Nullable public @Nullable ResolvedManagedDependency findManagedDependency(String groupId, String artifactId) -
findManagedDependency
@Nullable public @Nullable ResolvedManagedDependency findManagedDependency(org.openrewrite.xml.tree.Xml.Tag tag, @Nullable @Nullable Scope inClasspathOf) -
findDependency
@Nullable public @Nullable ResolvedDependency findDependency(org.openrewrite.xml.tree.Xml.Tag tag, @Nullable @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
-