Maven Local,Central and Remote Repositories

Maven repository is divided into 3 types :
  1. Maven local Repository
  2. Maven Central Repository
  3. Maven Remote Repository

Maven local repository :  It' place where all project dependency libraries which are specified in project's pom.xml are stored here after downloaded by Maven
Default to home directory is
    1. Unix/Mac OS X – ~/.m2 on 
    2. Windows – C:\Documents and Settings\.m2 on Windows
    This default location can be change by editing conf/setting.xml
    <!-- localRepository
       | The path to the local repository maven will use to store artifacts.
       |
       | Default: ~/.m2/repository
      <localRepository>/path/to/local/repo</localRepository>


    Add ex. <localRepository>C:/mavenrepo< /localRepository> and it's done

    Maven Central Repository : It's place from where maven download all project libraries. if  maven unable to find dependency libraries in local repository then it looks into this repository.

    Central repository location is : http://search.maven.org

     Maven Remote Repository : By default maven download libraries from central repository. if it's not able to find then it will look into remote repository. You need to include this repo into your project's pom.xml as

     <repositories>
        <repository>
          <id>java.net</id>
          <url>http://download.java.net/maven/2</url>
        </repository>
      </repositories>
      </repositories>

    Remote repository location : http://download.java.net/maven/2/.

    No comments:

    Post a Comment