This post talks about Understanding of Maven Repositories
What is Maven Repositories?
Maven downloads the required artifacts or dependencies (jar files) and other plugins which are configured as part of any project, there must be a commonplace where all such artifacts are placed. This common shared area is called a Repository.
Maven repositories are classified into 3 main categories:
This repository usually resides in our local machine. Which is cached from the remote/central repository downloads and ready for usage/reuse.
The directory to store all the dependencies in the local machine can be configured in the settings.xml file of the maven directory under the tag <localRepository>
<settings xmlns = "http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://maven.apache.org/SETTINGS/1.0.0
This repository as the name suggests resides in the remote server and can be accessed by using different file transfer protocols like file:// or http://.
The remote repository can be used for both downloading and uploading the dependencies and artifacts.
This is the repository provided by the maven community. This repository contains a large set of commonly used/required libraries for any java project.
Always keep in mind that we need an internet connection to use the central repository but no configuration is required to access this central repository(Optionally you can configure it).
How does Maven search for Dependencies?
when maven starts building the project by executing the build commands, maven starts searching the dependencies as explained below:
- First of all, maven scans through the local repositories for all the project dependencies. If found, then it continues with further execution. If the project dependencies configured are not found in the local repository, then it scans through the central repository.
- If the configured dependencies are available in the central repository then those dependencies will be downloaded to the local repository for future reference and usage. If not found, then the maven starts scanning into the remote repositories.
- If the remote repository has not been configured then maven will throw an exception with an error message not able to find the dependencies and stops further processing. If found, then those dependencies are downloaded to the local repository for future reference and usage.
That’s all about Understanding of Maven Repositories?
You May Also Like:
What is Maven?
How to install and setup Maven Environment on windows?
Create a maven project using the command line
How to import the maven project in Eclipse?
How to Create a New Maven Project in Eclipse
How to create a maven web application project in Eclipse
How to create a multi-module project using maven?
How to Fix missing src/main/java & src/test/java folders in the Eclipse Maven web Project?
How to create user-defined properties in Maven?
What is the maven local repository location & how to change it?
How to add or update the maven settings.xml file in eclipse?
Importing maven remote Archetype Catalogs in eclipse ?
What is POM in the maven Project?
What is Super POM in Maven Project?
Understanding the purpose of Maven Plugin
Compiling the Maven project with different JDK versions?
Understanding of settings.xml in maven
How to enable a proxy setting in Maven?
Maven Dependency Scopes
How to generate javadoc in the maven Project
How to create a runnable JAR file with Maven?
How to add local jar files to a Maven project?
How to convert an existing Java Project to Maven in Eclipse?
How to exclude dependency in maven?
Managing External Dependencies in maven
What is an archetype in Maven?
Snapshot Vs Version in maven
Apache Maven – Profiles
If you have any feedback or suggestion please feel free to drop in below comment box.