Package org.openrewrite.maven.tree
Class MavenResolutionResult
java.lang.Object
org.openrewrite.maven.tree.MavenResolutionResult
- All Implemented Interfaces:
org.openrewrite.marker.Marker
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindDependencies(String groupId, String artifactId, @Nullable Scope scope) Finds dependencies (including any transitive dependencies) in the model that match the provided group and artifact ids.findDependencies(Predicate<ResolvedDependency> matcher, @Nullable Scope scope) Finds dependencies (including any transitive dependencies) in the model that match the predicate.@Nullable ResolvedDependencygetResolvedDependency(Dependency dependency) @Nullable ResolvedManagedDependencygetResolvedManagedDependency(ManagedDependency dependency) booleanbooleanOften recipes operating on multi-module projects will prefer to make changes to the parent pom rather than in multiple child poms.resolveDependencies(MavenPomDownloader downloader, org.openrewrite.ExecutionContext ctx) voidunsafeSet(UUID id, ResolvedPom pom, List<MavenResolutionResult> modules, @Nullable MavenResolutionResult parent, Map<Scope, List<ResolvedDependency>> dependencies) voidunsafeSetModules(@Nullable List<MavenResolutionResult> modules) voidunsafeSetParent(MavenResolutionResult parent) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrewrite.marker.Marker
getId, print, withId
-
Constructor Details
-
MavenResolutionResult
public MavenResolutionResult()
-
-
Method Details
-
getActiveProfiles
-
unsafeSetManagedReference
-
getResolvedDependency
-
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 expressionartifactId- The artifactId as a glob expressionscope- 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 dependencyscope- 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
-
unsafeSetModules
-
getResolvedManagedDependency
public @Nullable ResolvedManagedDependency getResolvedManagedDependency(ManagedDependency dependency) -
resolveDependencies
public MavenResolutionResult resolveDependencies(MavenPomDownloader downloader, org.openrewrite.ExecutionContext ctx) throws MavenDownloadingExceptions - Throws:
MavenDownloadingExceptions
-
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()
-