Maven Repository

Maven repository for beginners and professionals with topics on maven example, plugin, pom, dependency, eclipse, repository, web application, eclipse example, servlet, jsp, struts, hibernate, spring etc.

Maven Repository

Maven Repository

A maven repository is a directory of packaged JAR file with pom.xml file. Maven searches for dependencies in the repositories. There are 3 types of maven repository:

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

Maven searches for the dependencies in the following order:

Local repository then Central repository then Remote repository.

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

1) Maven Local Repository

Maven local repository is located in your local system. It is created by the maven when you run any maven command.

By default, maven local repository is %USER_HOME%/.m2 directory. For example: C:\Users\SSS IT\.m2.

Update location of Local Repository

We can change the location of maven local repository by changing the settings.xml file. It is located in MAVEN_HOME/conf/settings.xml, for example: E:\apache-maven-3.1.1\conf\settings.xml.

Let's see the default code of settings.xml file.

  1. ...  
  2. <settings xmlns=""   
  3.    xmlns:xsi=""   
  4.    xsi:schemaLocation="">