Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change maven repository folder in windows?

In windows, maven downloads everything in the C:\Documents And Settings\MyUser\.m2 folder (or C:\Users\MyUser\.m2). There exists some way to change the folder that it uses? Specially I want to set it to download anywhere BUT in the Documents And Settings/Users folder.

like image 284
Victor Stafusa Avatar asked Dec 20 '10 13:12

Victor Stafusa


People also ask

Where is maven repository location in Windows?

Windows – C:\Users\{your-username}\. m2\repository.

Where is maven repository located in CMD?

For windows users Usually it's in: C:\Users\USER_NAME\. m2\repository . However the mvn help:effective-settings command will surely show the local path in response xml.


1 Answers

Look at your settings.xml in ${maven.home}/conf or, preferrably, ${user.home}/.m2/settings.xml (see this for details about the settings.xml). You can add (or uncomment) the following section:

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

as suggested by the commented out section already there by default. There, you should be able to change the path to achieve what you want.

like image 169
David Avatar answered Sep 25 '22 05:09

David