org.apache.maven.model.resolution
Interface ModelResolver


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.

Author:
Benjamin Bentmann

Method Summary
 void addRepository(Repository repository)
          Adds a repository to use for subsequent resolution requests.
 ModelResolver newCopy()
          Clones this resolver for usage in a forked resolution process.
 ModelSource resolveModel(String groupId, String artifactId, String version)
          Tries to resolve the POM for the specified coordinates.
 

Method Detail

resolveModel

ModelSource 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.

addRepository

void addRepository(Repository repository)
                   throws InvalidRepositoryException
Adds 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).

newCopy

ModelResolver 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 of addRepository(Repository) on the clone do not affect the state of the original resolver and vice versa.

Returns:
The cloned resolver, never null.


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.