Apache Maven: Local, Central and Remote Repositories

In this article, we will learn about different types of maven repositories. In simple, maven repositories contains packaged JARS of various modules

Three types of Maven repository are

  1. Local Repository
  2. Central Repository
  3. Remote Repository

Maven searches dependencies in the following order


Source: Team BenchResources.net

Local Repository

Local repository is the local directory on the developer’s computer. Generally, when you run maven command for the first time it downloads all dependent JARS from Central/Remote repositories and store in the default location

The default location is


If one wishes to change the default location to some user-defined location then you do by changing the <localRepository> element present in the settings.xml at MAVEN_HOME\conf\settings.xml

Update location with absolute path

<localRepository D:\M2_HOME\.m2\repository</localRepository>

New maven settings.xml

<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   | Default: ${user.home}/.m2/repository
<localRepository D:\M2_HOME\.m2\repository</localRepository>


Note: For the very first time it downloads packages JARS from either Central or Remote repository, from next time onwards it picks JARS from local repository i.e.; local directory of the developer’s computer even for different project


Central Repository

Central maven repository is located on the web at http://repo1.maven.org/maven/ and it is provided by Maven community

Note: First time, maven tries to download most of the JARS from this central repository


This site is now revamped and “Directory Browsing” is disabled at http://repo1.maven.org/maven/ and instead it re-directs to new site

This new site is much more advanced and has good browse functionality –> click View



Remote Repository

As shown in the first figure above, if the required JARS is not available in Local repository or Central repository then maven checks if there are any remote repository is configured else it stops and throws error

For example, JBoss dependencies are configured in pom.xml

		<!-- RESTEasy JAX RS Implementation -->

But if these JARS are not available in Central repository, and then in that case you need to tell maven to search and download these JARS from Remote repository configured in pom.xml



Maven dependencies checking rules

  • Maven searches to download dependencies from Local Repository, if not found next step
  • Maven searches to download dependencies from Central Repository, if not found checks whether any remote repositories are configured then go to next step otherwise stops & throws error
  • Maven searches to download dependencies from the configured Remote Repository, if found then download and do further processing otherwise stops & throws error


Read Also:


Happy Coding !!
Happy Learning !!

Apache Maven: Installing custom library into local repository
Apache Maven: Changing default Maven repository location in Windows 7 OS