Repositories of Maven

Maven repositories are directories of packaged JAR files with extra meta data like pom.xml .


POM files describing the projects each packaged JAR file belongs to, including what external dependencies each packaged JAR has. It is this metadata that enables Maven to download dependencies of your dependencies recursively until the whole tree of dependencies is download and put into your local repository.


There are 3 types of maven repository:

  1. Local Repository

  2. Central Repository

  3. Remote Repository


Maven searches these repositories for dependencies in the sequence. First in the local repository, then in the central repository, and third in remote repositories.


If the dependency is not found in these repositories, Maven stops processing and throws an error.


Maven Local Repository

Maven local repository is located on your local system. This repository will contain all the dependencies Maven downloads. The same Maven repository is typically used for several different projects. Thus Maven only needs to download the dependencies once, even if multiple projects depends on them.


By default, Maven puts your local repository inside your user home directory on your local computer.

Maven Dependencies


You can change the location of maven local repository by changing the settings.xml file.  You can find it in your unzipped maven directories. Like for me it’s –


You can change it. For example, you want to change my Local Repositories and make new Local Repository in D:\Maven\Local_Repo . Then we open the setting.xml and change the local repository tag value. For example –

Orignal –


The path to the local repository maven will use to store artifacts.
| Default: ${user.home}/.m2/repository

After Change it Would be –

The path to the local repository maven will use to store artifacts.

You have changed your Local Repository location.


Maven Central Repository

The central Maven repository is a repository provided by the Maven community. Maven central repository is located on the web. If maven is not found any dependency in the Local repository then it will dependency in Central Repository and Download the dependencies into your local Repository.

The central repository contains a lot of common libraries that can be viewed by this URL


Maven Remote Repository

A Remote repository is a repository on the web from which Maven can download dependencies. A remote repository can be located anywhere on the internet, or inside a local network.

A remote repository is often used for hosting projects internal to your organization, which is shared by multiple projects.


Dependencies found in a remote repository are also downloaded and put into your local repository by Maven.

You can configure a remote repository in the POM file. We will discuss the POM in coming tutorials.

0 Comment

Leave a Reply