Category: java
What is a Maven Repository
Published on 01 Jun 2026
Explanation
What is a Maven Repository?
A Maven
Repository is a storage location for
Java libraries, dependencies, plugins,
and project
artifacts. Maven automatically
downloads required dependencies
from repositories during the build process.
Code:
<dependency>
<groupId>org.springframework.boot
</groupId>
<artifactId>spring-boot-starter-web
</artifactId>
<version>3.5.0</version>
</dependency>
Explanation
Types of Maven Repositories
There are three
types of Maven repositories:
Local Repository
(on your machine), Central Repository
(public
repository), and Remote Repository
(organization-specific repository).
Code:
1. Local Repository 2. Central Repository 3. Remote Repository
Explanation
Local Repository
The Local Repository is stored
on your computer and caches downloaded
dependencies. Maven checks the
local repository
before downloading artifacts
from remote repositories.
Code:
~/.m2/repository/ ├── org/ ├── com/ └── net/
Explanation
Maven Central Repository
Maven Central is the
default public repository that
contains thousands
of open-source Java libraries.
Maven downloads
dependencies from Central when they are
not available locally.
Code:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.0.0-jre</version>
</dependency>
Explanation
Remote Repository
Organizations often maintain private
repositories
to store internal libraries and project
artifacts. Maven can be configured to
download dependencies from these
repositories.
Code:
<repositories>
<repository>
<id>company-repo</id>
<url>https://repo.company.com/maven2
</url>
</repository>
</repositories>