Package org.apache.maven.api
Interface Repository
- All Known Subinterfaces:
LocalRepository
,RemoteRepository
- All Known Implementing Classes:
DefaultLocalRepository
,DefaultRemoteRepository
In Maven, repositories are locations where project artifacts (such as JAR files, POM files, and other resources) are stored and retrieved. There are two primary types of repositories: local repositories and remote repositories.
Repository Resolution Process
When resolving dependencies, Maven follows this order:
- Check Local Repository: Maven first checks if the artifact is available in the local repository.
- Check Remote Repositories: If the artifact is not found locally, Maven queries the configured remote repositories in the order they are listed.
- Download and Cache: If Maven finds the artifact in a remote repository, it downloads it and stores it in the local repository for future use.
By caching artifacts in the local repository, Maven minimizes the need to repeatedly download the same artifacts, thus optimizing the build process.
Repository Configuration
Repositories can be configured at various levels:
- POM: Repositories can be specified in the
pom.xml
file under the<repositories>
and<pluginRepositories>
sections. - Settings: the
settings.xml
can be used to provide additional repositories in the three level of settings (user, project, installation).
- Since:
- 4.0.0
- See Also:
-
Field Summary
-
Method Summary
-
Field Details
-
CENTRAL_ID
The reserved id for Maven Central- See Also:
-
-
Method Details
-
getId
Gets the identifier of this repository.- Returns:
- the (case-sensitive) identifier, never
null
-
getType
Gets the type of the repository, for example "default".- Returns:
- the (case-sensitive) type of the repository, never
null
-