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.
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:
- Local Repository
- Central Repository
- 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.
- <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
- xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">