How to Change M2_REPO eclipse maven Repository Location

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

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.

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 .

Last Updated on 4 months by frugalis_blog