Maven, developed by the Apache Software Foundation, is a build automation tool for Java projects that handles tasks like dependency management, building, and testing. It automatically searches and downloads required dependencies from different repositories, making project management easier.
- Checks Local Repository first
- Then looks into Central/Remote Repositories

Repositories Available in Maven
Here are the repositories available in maven :
1. Local Repository
Local Repository is stored on your system and contains all downloaded dependency JAR files. Maven saves dependencies here so they can be reused across multiple projects, reducing the need to download them again.
- Located at C:\Users<user_name>.m2\repository (Windows)
- Stores all downloaded dependency JAR files
- Helps in reusing dependencies for other projects
Settings.xml File:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="https://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
...
</settings>
2. Central Repository
Central Repository is a remote repository available on the internet where Maven downloads dependencies if they are not found in the local repository. It is maintained by the Apache Maven team.
- Maven downloads dependencies from Central Repository if not found locally
- Default URL: https://repo.maven.apache.org/
- Supports mirrors (via settings.xml) and allows uploads with proper permissions
Settings.xml File:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="https://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<mirrors>
<mirror>
<id>centeal repo</id>
<name>repo_name</name>
<url>maven2</url>
<mirrorOf>https://repo.maven.apache.org/central</mirrorOf>
</mirror>
</mirrors>
...
</settings>
3. Internal Repository
Internal Repository is a private repository maintained by an organization to store its own libraries and dependencies. It is used when external downloads are restricted or when dependencies are not available in the central repository.
- Stores organization-specific artifacts and missing dependencies
- Configured in settings.xml for internal use
- Maven fetches dependencies from here if not found locally or centrally, otherwise shows “cannot resolve dependency” error
Settings.xml File:
<?xml version="1.0" encoding="UTF-8"?>
<repositories>
<repository>
<id>repo_id</id>
<url>//for example geeksforgeeks.com</url>
</repository>
</repositories>
Here the third local machine has restricted access to external sites, so it uses the internal repo to find the dependencies.