Class MavenResolutionResult

java.lang.Object
org.openrewrite.maven.tree.MavenResolutionResult
All Implemented Interfaces:
org.openrewrite.marker.Marker

public class MavenResolutionResult extends Object implements org.openrewrite.marker.Marker
  • Constructor Details

    • MavenResolutionResult

      public MavenResolutionResult()
  • Method Details

    • getActiveProfiles

      public List<String> getActiveProfiles()
    • unsafeSetManagedReference

      public MavenResolutionResult unsafeSetManagedReference(Integer id)
    • getResolvedDependency

      public @Nullable ResolvedDependency getResolvedDependency(Dependency dependency)
    • findDependencies

      public List<ResolvedDependency> findDependencies(String groupId, String artifactId, @Nullable Scope scope)
      Finds dependencies (including any transitive dependencies) in the model that match the provided group and artifact ids. The search can optionally be limited to a given scope.

      Note: It is possible for the same dependency to be returned multiple times if it is present in multiple scopes.

      Parameters:
      groupId - The groupId as a glob expression
      artifactId - The artifactId as a glob expression
      scope - The scope to limit the search to, or null to search all scopes
      Returns:
      A list of matching dependencies
    • findDependencies

      public List<ResolvedDependency> findDependencies(Predicate<ResolvedDependency> matcher, @Nullable Scope scope)
      Finds dependencies (including any transitive dependencies) in the model that match the predicate. The search can optionally be limited to a given scope.

      Note: It is possible for the same dependency to be returned multiple times if it is present in multiple scopes.

      Parameters:
      matcher - The predicate to match the dependency
      scope - A scope to limit the search to, or null to search all scopes
      Returns:
      A list of matching dependencies
    • unsafeSet

      public void unsafeSet(UUID id, ResolvedPom pom, List<MavenResolutionResult> modules, @Nullable MavenResolutionResult parent, Map<Scope,List<ResolvedDependency>> dependencies)
    • unsafeSetParent

      public void unsafeSetParent(MavenResolutionResult parent)
    • unsafeSetModules

      public void unsafeSetModules(@Nullable List<MavenResolutionResult> modules)
    • getResolvedManagedDependency

      public @Nullable ResolvedManagedDependency getResolvedManagedDependency(ManagedDependency dependency)
    • resolveDependencies

      public MavenResolutionResult resolveDependencies(MavenPomDownloader downloader, org.openrewrite.ExecutionContext ctx) throws MavenDownloadingExceptions
      Throws:
      MavenDownloadingExceptions
    • getProjectPoms

      public Map<Path,Pom> getProjectPoms()
    • parentPomIsProjectPom

      public boolean parentPomIsProjectPom()
      Often recipes operating on multi-module projects will prefer to make changes to the parent pom rather than in multiple child poms. But if the parent isn't in the same repository as the child, the recipe would need to be applied to the child poms.
      Returns:
      true when the parent pom of the current pom is present in the same repository as the current pom
    • isMultiModulePom

      public boolean isMultiModulePom()