ericlefevre

February 21, 2007

Changing maven local repository

Filed under: java, maven — Eric Lefevre @ 11:49 am

This is something that is not well documented on the web, though it is quite clearly in the default settings.xml file provided with the default Maven installation.

The default repository used by Maven 2 to store the various artifacts is <user_home>/.m2/repository. Under Windows, that translates to C:\Documents and Settings\<user>\.m2\repository.
On my client site, the size of the user home directory is severely restricted, presumably because it is being backed up. So, how do you change this value? Easy, once you know.

You need to have a settings.xml file, either in the <user_home>/.m2 directory, or in the <maven installation>/conf directory (make sure you keep a copy of the existing one). Add a new <localrepository> tag. On my machine, it looks like that:

<settings>  …

<localrepository>D:/mavenrepository</localrepository> <!– any type of slashes works –>

…

</settings>

That’s it!

3 Comments »

  1. Thanks a ton. I was looking for this information for quite some time. You saved my day.

    Comment by partha — April 3, 2008 @ 11:03 pm

  2. Thank you, very helpful.

    Also at least in maven 2.0.9 its

    D:\mavenrepository

    notice the capitol R in repository

    Comment by nthomas — April 18, 2008 @ 8:14 pm

  3. Lol alright well its

    &gtlocalRepository&ltC:\Tools\mavenRepo\repository&lt//localRepository&gt

    Comment by nthomas — April 18, 2008 @ 8:16 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress