Pages

Maven Repository

Maven repository is a place where we find or put the jar files, plug-ins. Maven use these repository to locate the dependencies of the project which we define in pom.xml file.

Maven uses three types of repository -

  • Local
  • Central
  • Remote
the order of searching the dependency by maven is given below -

local -- > central --> remote

first it search on local repository and then central repository  and then remote repository. if the maven is not find dependencies in these repository it throws error

Local Repository :  When you install and run maven first time, it will create a .m2 directory on your home directory, which contains a another directory name repository like -

    $HOME/.m2/repository

This the default location for the jar which maven check. If the particular jar is not in local repository then it will be downloaded from the remote repository which is set by maven when we installed the maven.

Central Repository : Maven central repository is a repository provided by Maven community. It contains a large number of commonly used libraries.

When Maven does not find any dependency in local repository, it starts searching in central repository using following URL: http://repo1.maven.org/maven2/

Remote Repository :  Which is developer's own custom repository containing required libraries or other project jars.

No comments:

Post a Comment