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 Details

    • MavenVisitor

      public MavenVisitor()
  • Method Details

    • getLanguage

      public String getLanguage()
      Overrides:
      getLanguage in class org.openrewrite.xml.XmlVisitor<P>
    • isAcceptable

      public boolean isAcceptable(org.openrewrite.SourceFile sourceFile, P p)
      Overrides:
      isAcceptable in class org.openrewrite.xml.XmlVisitor<P>
    • getResolutionResult

      protected MavenResolutionResult getResolutionResult()
    • isPropertyTag

      public boolean isPropertyTag()
    • isDependencyTag

      public boolean isDependencyTag()
    • isDependencyTag

      public boolean isDependencyTag(String groupId, String artifactId)
      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

      public boolean isPluginDependencyTag(String groupId, String artifactId)
    • isManagedDependencyTag

      public boolean isManagedDependencyTag()
    • isManagedDependencyTag

      public boolean isManagedDependencyTag(String groupId, String artifactId)
      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

      public boolean isManagedDependencyImportTag(String groupId, String artifactId)
    • maybeUpdateModel

      public void maybeUpdateModel()
    • isPluginTag

      public boolean isPluginTag()
    • isPluginTag

      public boolean isPluginTag(String groupId, @Nullable String artifactId)
    • isManagedPluginTag

      public boolean isManagedPluginTag()
    • isParentTag

      public boolean isParentTag()
    • isProjectTag

      public boolean isProjectTag()
    • findDependency

      public @Nullable ResolvedDependency findDependency(org.openrewrite.xml.tree.Xml.Tag tag)
    • findManagedDependency

      public @Nullable ResolvedManagedDependency findManagedDependency(org.openrewrite.xml.tree.Xml.Tag tag)
    • findManagedDependency

      public @Nullable ResolvedManagedDependency findManagedDependency(String groupId, String artifactId)
    • 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

      public List<ResolvedDependency> findDependencies(String groupId, String artifactId)
      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 match
      artifactId - The artifactId to match.
      Returns:
      dependencies (including transitive dependencies) with any version matching the provided group and artifact id, if any.
    • findDependencies

      public Collection<ResolvedDependency> findDependencies(Predicate<ResolvedDependency> matcher)
      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

      public @Nullable Plugin findPlugin(org.openrewrite.xml.tree.Xml.Tag tag)
    • findManagedPlugin

      public @Nullable Plugin findManagedPlugin(org.openrewrite.xml.tree.Xml.Tag tag)