Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue in adding M2_REPO variable in eclipse

I am adding M2_REPO variable in eclipse using Window --> Preferences --> Java --> Build Path --> Classpath Variables --> New --> and then providing name as M2_REPO and selecting maven repository folder, then I see this variable getting added in the Classpath variables list. Then I click OK button.

After that, if again I see the above Classpath variables, then i don't find the M2_REPO variable there, due to which I am getting Unbound classpath variable: M2_REPO/....jar error in my project.

Can someone please help.

like image 347
Anand Avatar asked Dec 03 '12 08:12

Anand


People also ask

How to change m2_ REPO Path in Eclipse?

To modify the M2_REPO value, you need to change it at Eclipse's Maven configuration page. Select Windows -> Preferences -> Maven -> User Settings. Figure – Change it to another Maven repository. Once above value is updated, it will update the M2_REPO classpath variable automatically.

What is M2_REPO?

m2_repo points to maven's local repository location in workspace. m2_repo class variable must be added to eclipse's class path variable on build path before using maven's dependencies.


1 Answers

Check for settings.xml in

Window --> Preferences --> Maven ---> User Settings

If not, set it there and change localRepository path in settings tag inside settings.xml. Normally you will find settings.xml in .m2 folder under the user folder (for eg. C:\Documents and Settings\userName.m2).

like image 66
Vishal Pahuja Avatar answered Oct 05 '22 09:10

Vishal Pahuja