Vaibhav
Vaibhav

Reputation: 3245

Local Maven Repository

While working with Maven repository, I understand that Jars gets downloaded at .m2 repository in the hard disk. I want to give it a customized name at my desired location, say "C:\Users\Vamee\Desktop". I read somewhere that I should make changes in settings.xml like below

{M2_HOME}\conf\settings.xml

/path/to/local/repo

C:\Users\Vamee\Desktop

But problem is that I am unable to find Settings.xml in my file system. Please tell me where is Settings.xml or is there any other way to do it.

Upvotes: 0

Views: 5939

Answers (7)

Aboozar Rajabi
Aboozar Rajabi

Reputation: 1793

The maven local repository is located in the /home/.m2 directory, the folder is probably hidden. So, you'll need to press Ctrl+H to see hidden folders. Try finding the setting file there.

Upvotes: -1

Krzysiek Novak
Krzysiek Novak

Reputation: 56

This worked for me in the Kepler version of Eclipse for the inbuilt Maven:

  1. Create settings.xml in %USERPROFILE%/.m2
  2. Add an entry to the settings.xml defining your desired location of the cache, as per SubOptimal's answer above: x:/your/local/repository
  3. In Eclipse go Window->Preferences->Maven->User Settings and make sure that the "User Settings" field is set to the full path of your settings.xml file e.g.: C:\Users\user\.m2\settings.xml
  4. The read-only "Local Repository" field should show your newly defined cache location.
  5. Hit the "Update Settings" or "Apply" button. That should start the process of updating the Maven cache. It might take quite a while.

Upvotes: 0

Vidya
Vidya

Reputation: 30310

It depends on the operating system, but basically it is in the .m2 folder your home directory. Or in the conf folder in $M2_HOME. See here.

So it sounds for you like it should be in C:\Users\Vamee\.m2.

Upvotes: 0

SubOptimal
SubOptimal

Reputation: 22993

the environment variable M2_HOME should point to the Maven installation directory.

e.g. if Maven is installed into C:\Program Files\Maven
set M2_HOME=C:\Program Files\Maven
dir "%M2_HOME%\conf\settings.xml"

In the settings.xml you can set the path to your local maven repository.

<localRepository>x:/your/local/repository</localRepository>

Upvotes: 3

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 136142

If you are able to find Maven installation directory in your file system you will certainly find settings.xml in its conf folder.

Upvotes: 0

Tim Boudreau
Tim Boudreau

Reputation: 1791

settings.xml may not exist - you have to create it. Then just modify it as described here

Upvotes: 0

thst
thst

Reputation: 4602

It is in your %USERPROFILE% folder, usually c:\users\yourname\.m2

Upvotes: 0

Related Questions