Unbound classpath variable
If you already did several times STEP 1, go to STEP 2
STEP 1
Try deleting and redefining env vars:
- Open the 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 folder. For example, my repository folder is
C:/Users/user/.m2/repository
- Rebuild the Project.
Beside from inside of Eclipse, you can also add the M2_REPO variable from command line using this Maven command:
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
STEP 2
If your build path is correctly defined, check Maven settings.xml:
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).
Well, I tried the steps in @Jordi's answer. But those didn't make any difference. And I tried some ritualistic things in eclipse such as:
- closing the project and opening it
- restarting the IDE
- cleaning and rebuilding etc...
with no success.
Then strange thing happened when I changed the Java complience level to 1.8 and revert it back to 1.6. It worked! All unbound classpath variable errors are gone now.
Update Project
worked for me :
Step 1 : Select Project Folder
Select the project folder that is giving the error.
Step 2 : Update Maven Project
Alt + F5
shortcut OR right-click >> Maven >> Update Project
.
Step 3 : Finalize
Click OK
and let it update.
The errors should disappear after that.
Good Luck