How to Change M2_REPO eclipse maven Repository Location

tom

Updated on:

Maven reads dependencies from .m2 folder .Maven dependencies are read by eclipse from maven repository using M2_REPO classpath variable . M2_REPO points to maven local repository location in eclipse .

Where is M2_REPO ?

M2_REPO is present in classpath under Eclipse or Spring Tool Suite .

Window->Preferences->Java->Build Path -> Classpath

image
M2_REPO non modifiable solved

As we can see above M2_REPO is non modifiable , so How can we solve this error to change M2_REPO .

How to Solve the M2_REPO is non Modifiable

To modify the M2_REPO value, you need to change it at Eclipse’s Maven configuration page. Select Windows -> Preferences -> Maven -> User Settings.

image 1
M2_REPO Change Manually .

Once settings is updated M2_REPO will also get updated automatically .There is also an option to manually change or forcefully update the M2_REPO maven repository location .