Q:

Unbound classpath variable

When rebuilding my project with Maven I sometimes get hundreds of 

'unbound classpath variable M2_REPO/etc/..'

in my eclipse errors, most of the time when I rebuild again it goes away but on this occasion its cursed me enough to stick around.
When actually going through the file system, the jars it details that are not there are actually there. Eclipse is just not seeing them for some reason. My m2_repo is correctly referenced in my preferences->java->classpathvariables section and my environmental variables are likewise properly set.
Any ideas for me folks?

A:

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).

A:

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.

