Tuesday, April 29, 2014

Unbound Classpath Variable M2_REPO error in Eclipse

Problem Description :

My Eclipse IDE gives errors whenever I try to build the project . The problems tab shows the message as given below

Unbound classpath variable: 'M2_REPO/...'



Solution :
M2_REPO is a classpath variable that tells eclipse where maven repository is on your disk .


Setting M2_REPO 

  • Open Eclipse Preferences [Window -> Preferences]
  • Go to [Java -> Build Path -> Classpath Variables]
  • Click New and set its name as M2_REPO
  • Click Folder and select your Maven repository directory on your machine . For example,on my machine , its H:\WDP\.m2\repository
  • Rebuild the Project.
  • DONE.