Maven local repository location

  • 04 April 2018
  • ADM

 

Maven local repository location - images/logos/maven.jpg

 

The maven local repository is a local folder that is used to store all your project's dependencies.

The default location is .m2 folder located in:

  • ~/.m2 for Linux
  • C:\Document and Settings\{your_username}\.m2 for Windows XP
  • C:\Users\{your_username}\.m2 for Windows 7 and up

Change the location

To change the default location you need to find the {M2_HOME}\conf\setting.xml file and edit the localRepository key.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>/path/to/local/repo</localRepository>

</settings>

 

References