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.
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.
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With