Where is Maven local repository?

The maven local repository is a local folder that is used to store all your project’s dependencies (plugin jars and other files which are downloaded by Maven). In simple, when you build a Maven project, all dependency files will be stored in your Maven local repository.

By default, Maven local repository is default to .m2 folder :

  1. Unix/Mac OS X – ~/.m2
  2. Windows – C:\Documents and Settings\{your-username}\.m2

1. Update Maven Local Repository

Normally, I will change the default local repository folder from default .m2 to another more meaningful name, for example, maven-repo.

Find {M2_HOME}\conf\setting.xml, update localRepository to something else.

  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   | Default: ~/.m2/repository

2. Saved it

Done, your new Maven local repository is now changed to D:/maven_repo.

See figure :

Maven local repository


  1. Introduction to Repositories
Tags :

About the Author

Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.