Sunday, 15 May 2016

What are different repository types in Maven ?


Maven repo
  • A directory of JAR file with pom.xml file
  • used to search the dependencies
    • Order of searching dependencies : Local -> Central -> Remote

1. Local
  • in local system (Default : %USER_HOME%/.m2 directory)
  • To change location : MAVEN_HOME/conf/settings.xml
  • Directory automatically created when you run any maven command

Change location of local repo in settings.xml
<settings>
  <localRepository>/path</localRepository> 
</settings>


2. Central

3. Remote
  • Available on internet
  • Some libraries which are not available on Central repo , they can be found in Remote repo
  • Libraries (to use from Remote repo) are specified in pom.xml

Using libraries from Remote repo
<project>
  ....
  <dependencies>
     <dependency>
         <groupId>org.apache.wicket</groupId>
         <artifactId>wicket</artifactId>
         <version>1.4.21</version>
     </dependency>
  </dependencies>
</project>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.