Class DefaultModelResolver
java.lang.Object
org.apache.maven.repository.internal.DefaultModelResolver
- All Implemented Interfaces:
ModelResolver
A model resolver to assist building of dependency POMs. This resolver gives priority to those repositories that have
been initially specified and repositories discovered in dependency POMs are recessively merged into the search chain.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final List<org.eclipse.aether.repository.RemoteRepository> private final org.eclipse.aether.impl.RemoteRepositoryManagerprivate List<org.eclipse.aether.repository.RemoteRepository> private final org.eclipse.aether.impl.ArtifactResolverprivate final org.eclipse.aether.RepositorySystemSessionprivate final org.eclipse.aether.RequestTraceprivate final org.eclipse.aether.impl.VersionRangeResolver -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDefaultModelResolver(DefaultModelResolver original) (package private)DefaultModelResolver(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.RequestTrace trace, String context, org.eclipse.aether.impl.ArtifactResolver resolver, org.eclipse.aether.impl.VersionRangeResolver versionRangeResolver, org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager, List<org.eclipse.aether.repository.RemoteRepository> repositories) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRepository(Repository repository) Adds a repository to use for subsequent resolution requests.voidaddRepository(Repository repository, boolean replace) Adds a repository to use for subsequent resolution requests.newCopy()Clones this resolver for usage in a forked resolution process.private static voidremoveMatchingRepository(Iterable<org.eclipse.aether.repository.RemoteRepository> repositories, String id) resolveModel(String groupId, String artifactId, String version) Tries to resolve the POM for the specified coordinates.resolveModel(Dependency dependency) Tries to resolve the POM for the specified dependency coordinates possibly updatingdependency.resolveModel(Parent parent) Tries to resolve the POM for the specified parent coordinates possibly updatingparent.
-
Field Details
-
session
private final org.eclipse.aether.RepositorySystemSession session -
trace
private final org.eclipse.aether.RequestTrace trace -
context
-
repositories
-
externalRepositories
-
resolver
private final org.eclipse.aether.impl.ArtifactResolver resolver -
versionRangeResolver
private final org.eclipse.aether.impl.VersionRangeResolver versionRangeResolver -
remoteRepositoryManager
private final org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager -
repositoryIds
-
-
Constructor Details
-
DefaultModelResolver
DefaultModelResolver(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.RequestTrace trace, String context, org.eclipse.aether.impl.ArtifactResolver resolver, org.eclipse.aether.impl.VersionRangeResolver versionRangeResolver, org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager, List<org.eclipse.aether.repository.RemoteRepository> repositories) -
DefaultModelResolver
-
-
Method Details
-
addRepository
Description copied from interface:ModelResolverAdds a repository to use for subsequent resolution requests. The order in which repositories are added matters, repositories that were added first should also be searched first. When multiple repositories with the same identifier are added, only the first repository being added will be used.- Specified by:
addRepositoryin interfaceModelResolver- Parameters:
repository- The repository to add to the internal search chain, must not benull.- Throws:
InvalidRepositoryException- If the repository could not be added (e.g. due to invalid URL or layout).
-
addRepository
Description copied from interface:ModelResolverAdds a repository to use for subsequent resolution requests. The order in which repositories are added matters, repositories that were added first should also be searched first. When multiple repositories with the same identifier are added, then the value of the replace argument is determines the behaviour. If replace is false than any existing repository with the same Id will remain in use. If replace is true the new repository replaces the original.- Specified by:
addRepositoryin interfaceModelResolver- Parameters:
repository- The repository to add to the internal search chain, must not benull.- Throws:
InvalidRepositoryException- If the repository could not be added (e.g. due to invalid URL or layout).
-
removeMatchingRepository
-
newCopy
Description copied from interface:ModelResolverClones this resolver for usage in a forked resolution process. In general, implementors need not provide a deep clone. The only requirement is that invocations ofModelResolver.addRepository(Repository)on the clone do not affect the state of the original resolver and vice versa.- Specified by:
newCopyin interfaceModelResolver- Returns:
- The cloned resolver, never
null.
-
resolveModel
public ModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException Description copied from interface:ModelResolverTries to resolve the POM for the specified coordinates.- Specified by:
resolveModelin interfaceModelResolver- Parameters:
groupId- The group identifier of the POM, must not benull.artifactId- The artifact identifier of the POM, must not benull.version- The version of the POM, must not benull.- Returns:
- The source of the requested POM, never
null. - Throws:
UnresolvableModelException- If the POM could not be resolved from any configured repository.
-
resolveModel
Description copied from interface:ModelResolverTries to resolve the POM for the specified parent coordinates possibly updatingparent.Unlike the
ModelResolver.resolveModel(java.lang.String, java.lang.String, java.lang.String)method, this method supports version ranges and updates the givenparentinstance to match the returnedModelSource. Ifparentdeclares a version range, the version corresponding to the returnedModelSourcewill be set on the givenparent.- Specified by:
resolveModelin interfaceModelResolver- Parameters:
parent- The parent coordinates to resolve, must not benull.- Returns:
- The source of the requested POM, never
null. - Throws:
UnresolvableModelException- If the POM could not be resolved from any configured repository.- See Also:
-
resolveModel
Description copied from interface:ModelResolverTries to resolve the POM for the specified dependency coordinates possibly updatingdependency.Unlike the
ModelResolver.resolveModel(java.lang.String, java.lang.String, java.lang.String)method, this method supports version ranges and updates the givendependencyinstance to match the returnedModelSource. Ifdependencydeclares a version range, the version corresponding to the returnedModelSourcewill be set on the givendependency.- Specified by:
resolveModelin interfaceModelResolver- Parameters:
dependency- The dependency coordinates to resolve, must not benull.- Returns:
- The source of the requested POM, never
null. - Throws:
UnresolvableModelException- If the POM could not be resolved from any configured repository.- See Also:
-