Site icon TestingDocs.com

Understanding Maven Repositories

Introduction

A repository is a directory where maven build artifacts are stored. Different types of Maven repositories are as follows

Local Repository

It is your local folder in which artifacts and dependencies are stored on your computer. Maven automatically downloads the dependencies into the local repository.

Default location of Maven local repository is .m2 folder. Default: ${user.home}/.m2/repository

<localRepository> in settings.xml file can be used to override the local repository directory location.

 

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

 

The Central Repository

This is the repository provided by the community. It is located on repo.maven.apache.org. This repository contains a large number of artifacts from different providers.

 

 

It contains the jars and artifacts that are commonly used. You can search the repository for relevant jars and artifacts as shown below.

 

Remote Repository

Remote repositories are custom internal repositories containing artifacts used by projects in the enterprise. This is a remote folder in which jars and other build artifacts are stored. These can be located on internal servers within your enterprise. Furthermore, you can specify the remote repositories in the POM.xml file. Maven will download the dependency from this repository.

<repositories>
 <repository>
 <id>sampleorganization.repo</id>
 <url>http://www.sampleorg.com/maven/etc</url>
 </repository>
</repositories>

 

Maven Tutorials on this website can be found at:
https://www.testingdocs.com/apache-maven-tutorial/

 

Exit mobile version