Change Maven Local Repository

Change Maven Local Repository

What is maven local repository: Maven local repository points your own copy of dependencies that work as cache of remote downloads and this also stores build artifacts which could be your future release candidate. Its not recommend to use version control to store jars file and for this purpose maven promotes use of local repository where JAR or build artifacts of many projects can be stored and shared with any number of builds. Maven provides default location of local repository as below:

  • Windows system: ${user.home}/.m2/repository
  • Linux/MAC: ~/.m2
  • To see its default location please open settting.xml file from your M2_HOME\conf folder and search below:

Change Maven Local Repository

  • Now if you want to change its default location please add local repository as below:

Change Maven Local Repository

  • Once you are done with it please save this file and point this setting.xml file in your project you will see your maven project local repository got updated with dependent jars. To verify it please go to your local repository and check for dependent jars . Below sample screen shot:

Change Maven Local Repository

  •  To configure setting.xml for your maven project please refer this tutorial
  • For more information please visit Apache Maven official site here

Leave a Reply

Your email address will not be published. Required fields are marked *