Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to relocate Netbeans' %USERPROFILE%\.m2 directory?

I can move the .netbeans directory from my user directory but I cannot find how to move the .m2 directory.
Changing Netbeans'user home worked on 7.0.1, but now I upgraded to 7.1.1 and the same configuration changes as before aren't cutting it.

Is there some special way to move the .m2 folder?

like image 567
Richard Robertson Avatar asked Apr 21 '12 21:04

Richard Robertson


People also ask

Can we create .m2 folder manually?

If you want to create a folder with a . prefix on Windows, you can simply do this on the command line. At the command prompt type md c:\Users\Jonathan\. m2 (or equivalent for your ${user.

What is the significance of .m2 folder?

m2 folder is the default folder used by maven to store its: settings. xml file which specifies properties, like the central repository to download your dependencies, the location of the so-called localRepository. by default, the localRepository in which maven stores all the dependencies your project might need to run.


2 Answers

C:\Program Files\NetBeans 7.1.1\java\maven\conf\settings.xml

Changed localRepository in this file and it finally worked. Can't tell you how frustrating this has been.

like image 185
Richard Robertson Avatar answered Oct 03 '22 22:10

Richard Robertson


Considering the Maven guide refers to everything (settings, repository, ...) as in "${user.home}/.../", the official way a new user.home for Maven.

MAVEN_OPTS=-Duser.home=/new/user/home

If it isn't working for some reason with NetBeans 7.1.1, a temporary workaround would be using a junction (Windows Xp) or a mklink (Windows Vista or Seven) in order to redirect the .m2 directory to another path.

like image 41
VonC Avatar answered Oct 03 '22 21:10

VonC