What is Maven Repository?

Maven Repository is defined as storehouse of artifacts and dependencies of various types.

 Types of Repository

  1. Local repository – A directory on local computer where maven runs, local repository caches remote dependencies (for offline mode purpose) and local builds artifacts that are not yet released (SNAPSHOT version)
  2. Remote repository – A remote directory which can be accessed via file:// and http://. A remote repository can be either setup by third party or within organization (to share private artifacts between development team and release) or can be central maven repository (for example, repo.maven.apache.org ) for downloading artifacts

Local and remote repositories are structured the same way to run on either side, or they can be synced for offline use.

Connecting to Repository…

Our project start connecting to repository when the POM.xml contains dependencies to download from remote if not available from local repository,

      <!-- This is not a jar dependency, so we must specify type. -->
      <!-- This is not a jar dependency, so we must specify type. -->

The dependencies are downloaded based on reference mentioned using {groupId, artifactId, type, classifier}. 

Building Offline

If you are temporarily disconnected from the internet and you need to build your projects offline, you can use the offline switch on the CLI:

mvn -o package

Many plugins honor the offline setting and do not perform any operations that connect to the internet.

Uploading to a Remote Repository

While this is possible for any type of remote repository, you must have the permission to do so.

Internal Repositories

When using Maven, particularly in a corporate environment, connecting to the internet to download dependencies is not acceptable for security, speed or bandwidth reasons. For that reason, it is desirable to set up an internal repository to house a copy of artifacts, and to publish private artifacts to.

Such an internal repository can be downloaded using HTTP or the file system (with a file:// URL), and uploaded to using SCP, FTP, or a file copy.

As far as Maven is concerned, there is nothing special about this repository: it is another remote repository that contains artifacts to download to a user’s local cache, and is a publish destination for artifact releases.

Using the Internal Repository

Using the internal repository is quite simple. Simply make a change to add a repositories element:


If your internal repository requires authentication, the id element can be used in your settings file to specify login information.

Deploying to the Internal Repository

One of the most important reasons to have one or more internal repositories is to be able to publish your own private releases.


Hence we saw what is repository, types of repository, how connection is established for repository and its usage.