Interface ModelResolver
- All Known Implementing Classes:
- ProjectModelResolver
public interface ModelResolver
Resolves a POM from its coordinates. During the build process, the
 
ModelBuilder will add any relevant repositories to the model resolver. In
 other words, the model resolver is stateful and should not be reused across multiple model building requests.- 
Method SummaryModifier and TypeMethodDescriptiondefault voidaddRepository(Repository repository) default voidaddRepository(Repository repository, boolean replace) 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.newCopy()Clones this resolver for usage in a forked resolution process.resolveModel(String groupId, String artifactId, String version) Tries to resolve the POM for the specified coordinates.default ModelSourceresolveModel(Dependency dependency, AtomicReference<Dependency> modified) default ModelSourceresolveModel(Parent parent, AtomicReference<Parent> modified) 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.
- 
Method Details- 
resolveModelModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException Tries to resolve the POM for the specified coordinates.- Parameters:
- groupId- The group identifier of the POM, must not be- null.
- artifactId- The artifact identifier of the POM, must not be- null.
- version- The version of the POM, must not be- null.
- Returns:
- The source of the requested POM, never null.
- Throws:
- UnresolvableModelException- If the POM could not be resolved from any configured repository.
 
- 
resolveModelTries to resolve the POM for the specified parent coordinates possibly updatingparent.Unlike the 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.- Parameters:
- parent- The parent coordinates to resolve, must not be- null.
- Returns:
- The source of the requested POM, never null.
- Throws:
- UnresolvableModelException- If the POM could not be resolved from any configured repository.
- Since:
- 3.2.2
- See Also:
 
- 
resolveModelTries to resolve the POM for the specified dependency coordinates possibly updatingdependency.Unlike the 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.- Parameters:
- dependency- The dependency coordinates to resolve, must not be- null.
- Returns:
- The source of the requested POM, never null.
- Throws:
- UnresolvableModelException- If the POM could not be resolved from any configured repository.
- Since:
- 3.5.0
- See Also:
 
- 
addRepositoryAdds 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.- Parameters:
- repository- The repository to add to the internal search chain, must not be- null.
- Throws:
- InvalidRepositoryException- If the repository could not be added (e.g. due to invalid URL or layout).
 
- 
addRepositoryAdds 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 determines the behaviour. If replace is false then any existing repository with the same Id will remain in use. If replace is true the new repository replaces the original.- Parameters:
- repository- The repository to add to the internal search chain, must not be- null.
- Throws:
- InvalidRepositoryException- If the repository could not be added (e.g. due to invalid URL or layout).
 
- 
newCopyModelResolver newCopy()Clones this resolver for usage in a forked resolution process. In general, implementors need not provide a deep clone. The only requirement is that invocations ofaddRepository(Repository)on the clone do not affect the state of the original resolver and vice versa.- Returns:
- The cloned resolver, never null.
 
- 
resolveModeldefault ModelSource resolveModel(Parent parent, AtomicReference<Parent> modified) throws UnresolvableModelException - Throws:
- UnresolvableModelException
 
- 
resolveModeldefault ModelSource resolveModel(Dependency dependency, AtomicReference<Dependency> modified) throws UnresolvableModelException - Throws:
- UnresolvableModelException
 
- 
addRepository- Throws:
- InvalidRepositoryException
 
- 
addRepositorydefault void addRepository(Repository repository, boolean replace) throws InvalidRepositoryException - Throws:
- InvalidRepositoryException
 
 
-