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.


  • Pingback: enagic()

  • Pingback: alkaline water benefits()

  • Pingback: best bottled water()

  • Pingback: water ionizer()

  • Pingback: tv online, online tv()

  • Pingback: streaming movies()

  • Pingback: watch free movies online()

  • Pingback: streaming movies()

  • Pingback: how to increase leptin()

  • Pingback: Blue Coaster33()

  • Amal

    Hi i’m using netbeans 7.3 and i can’t find maven repository browser in (window->other ).

  • Al Mobe

    You just missed about the eclipse update for this solution. I found a best practice to change maven local repository here

  • http://elzakaria.byethost15.com elzakaria

    Thanks a lot, just curious, when you said

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

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

    Or it is correct?
    Thanks :)

    • Rajesh

      Exactly !!!

  • http://undebugable.wordpress.com Yoesoff

    simple and helpful, thanks

  • Pingback: Where is maven central repository? | Yêu công ngh? dot com()

  • Oskar

    Hi there
    I’m quite new to maven and I’ve been trying to rotate the location of the settings.xml file, as I need it under version control, thus in a specific directory.
    So far I tried “export MAVEN_OPTS=-Dorg.apache.maven.user-settings=/path/to/directory/settings.xml”
    But unfortunatly that doesn’t work. It tried this because it works with switching the local repo with “export MAVEN_OPTS=-Dmaven.local.repo=/path/to/repo”.
    Does anybody know how this could be accompished without using “mvn -s /path/to/directory/settings.xml someplugin:someGoal” ? Any hints, tips, tricks would be great,…. google could not really solve this… :(

    Cheers Oskar

  • Natwar Sharma

    Short and sweet.Thanks alot man!!

  • Nagesh

    Very info.
    I’m follower of your blog/sites of Java. Thanks a lot for your efforts to make my life easy.

  • Pingback: How to create a Java project with Maven()

  • Pingback: How to download from Maven remote repository?()

  • Satya Marrapu

    Hi yong i’m doing what you were specify in tutorial, but i’m getting BUILD-ERROR.

    How to resolve that, plz help me

  • sumit das

    Thanks. Simple and clear description.

    Keep up the good work.

  • Younus

    Still am not getting the repo folder

  • Reddy

    im new to maven

    Help me
    how create a .m2 directory in c:users/directory

  • http://rafaeln.com Rafa

    Is there a typo in the text for “settings.xml”? I think the line:


    should read:


    based on the directory structure you displayed in the image.

    • William

      I was even second guessing whether Maven translated _ to / or something, until I read your comment.

  • marcos

    Short and clean. Thanks a lot!!

  • Pingback: Where is maven central repository ?()

  • Pingback: Maven Tutorials | J2EE Web Development Tutorials()

  • Pingback: How to create a project with Maven template | Maven()