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 :
- Unix/Mac OS X –
~/.m2 - 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.
{M2_HOME}\conf\setting.xml
<settings> <!-- localRepository | The path to the local repository maven will use to store artifacts. | | Default: ~/.m2/repository <localRepository>/path/to/local/repo</localRepository> --> <localRepository>D:/maven_repo</localRepository>
2. Saved it
Done, your new Maven local repository is now changed to D:/maven_repo.
See figure :

References
Tags : maven maven-faq maven-repo

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
Short and sweet.Thanks alot man!!
Very info.
I’m follower of your blog/sites of Java. Thanks a lot for your efforts to make my life easy.
Hi yong i’m doing what you were specify in tutorial, but i’m getting BUILD-ERROR.
How to resolve that, plz help me
Thanks. Simple and clear description.
Keep up the good work.
Still am not getting the repo folder
Hi,
im new to maven
Help me
how create a .m2 directory in c:users/directory
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.
Short and clean. Thanks a lot!!