Package org.apache.maven.project
Class ProjectModelResolver
- java.lang.Object
-
- org.apache.maven.project.ProjectModelResolver
-
- All Implemented Interfaces:
ModelResolver
public class ProjectModelResolver extends java.lang.Object implements ModelResolver
A model resolver to assist building of projects. This resolver gives priority to those repositories that have been declared in the POM.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringcontextprivate java.util.List<org.eclipse.aether.repository.RemoteRepository>externalRepositoriesprivate ReactorModelPoolmodelPoolprivate java.util.List<org.eclipse.aether.repository.RemoteRepository>pomRepositoriesprivate org.eclipse.aether.impl.RemoteRepositoryManagerremoteRepositoryManagerprivate java.util.List<org.eclipse.aether.repository.RemoteRepository>repositoriesprivate java.util.Set<java.lang.String>repositoryIdsprivate ProjectBuildingRequest.RepositoryMergingrepositoryMergingprivate org.eclipse.aether.RepositorySystemresolverprivate org.eclipse.aether.RepositorySystemSessionsessionprivate org.eclipse.aether.RequestTracetrace
-
Constructor Summary
Constructors Modifier Constructor Description privateProjectModelResolver(ProjectModelResolver original)ProjectModelResolver(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.RequestTrace trace, org.eclipse.aether.RepositorySystem resolver, org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager, java.util.List<org.eclipse.aether.repository.RemoteRepository> repositories, ProjectBuildingRequest.RepositoryMerging repositoryMerging, ReactorModelPool modelPool)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRepository(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.ModelResolvernewCopy()Clones this resolver for usage in a forked resolution process.private static voidremoveMatchingRepository(java.lang.Iterable<org.eclipse.aether.repository.RemoteRepository> repositories, java.lang.String id)ModelSourceresolveModel(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)Tries to resolve the POM for the specified coordinates.ModelSourceresolveModel(Dependency dependency)Tries to resolve the POM for the specified dependency coordinates possibly updatingdependency.ModelSourceresolveModel(Parent parent)Tries to resolve the POM for the specified parent coordinates possibly updatingparent.
-
-
-
Field Detail
-
session
private final org.eclipse.aether.RepositorySystemSession session
-
trace
private final org.eclipse.aether.RequestTrace trace
-
context
private final java.lang.String context
- See Also:
- Constant Field Values
-
repositories
private java.util.List<org.eclipse.aether.repository.RemoteRepository> repositories
-
pomRepositories
private java.util.List<org.eclipse.aether.repository.RemoteRepository> pomRepositories
-
externalRepositories
private final java.util.List<org.eclipse.aether.repository.RemoteRepository> externalRepositories
-
resolver
private final org.eclipse.aether.RepositorySystem resolver
-
remoteRepositoryManager
private final org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager
-
repositoryIds
private final java.util.Set<java.lang.String> repositoryIds
-
modelPool
private final ReactorModelPool modelPool
-
repositoryMerging
private final ProjectBuildingRequest.RepositoryMerging repositoryMerging
-
-
Constructor Detail
-
ProjectModelResolver
public ProjectModelResolver(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.RequestTrace trace, org.eclipse.aether.RepositorySystem resolver, org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager, java.util.List<org.eclipse.aether.repository.RemoteRepository> repositories, ProjectBuildingRequest.RepositoryMerging repositoryMerging, ReactorModelPool modelPool)
-
ProjectModelResolver
private ProjectModelResolver(ProjectModelResolver original)
-
-
Method Detail
-
addRepository
public void addRepository(Repository repository) throws InvalidRepositoryException
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
public void addRepository(Repository repository, boolean replace) throws InvalidRepositoryException
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
private static void removeMatchingRepository(java.lang.Iterable<org.eclipse.aether.repository.RemoteRepository> repositories, java.lang.String id)
-
newCopy
public ModelResolver 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(java.lang.String groupId, java.lang.String artifactId, java.lang.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
public ModelSource resolveModel(Parent parent) throws UnresolvableModelException
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:
Parent.clone()
-
resolveModel
public ModelSource resolveModel(Dependency dependency) throws UnresolvableModelException
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:
Dependency.clone()
-
-