from:http://tonychanhoho.iteye.com/blog/1584324
M2_repo is a storage location used to define the MAVEN 2 repository on the hard disk, and Windows defaults to the C:\Users\ machine name \.m2\repository. The M2eclipse plug-in is installed with the appropriate settings in eclipse.
Creating an Eclipse-enabled project with Maven is very simple, in the MVN project directory (enter the folder shift+ right-click into cmd):
MVN Eclipse:eclipse
Can.
Then open eclipse->import->general:existing Projects into workspace-> contains the catalog for the project, and Eclipse automatically searches for the Eclipse project that you just created.
When you import the project, you will find the Eclipse newspaper "can't find M2_repo" error, in fact, this is an environment variable, that is point to your local library. Both Linux and Windows are $home/.m2/repository.
Add the variable to eclipse by:
Windows-Preferences, Java---Build Path, Classpath Variables, new,name input m2_repo,path input/home/user/.m2 /repository (with desktop sibling directory). The error disappears after confirmation.
Once you've made such a setup, Eclipse integrates MAVEN functionality, and if you add a new dependent jar package in Pom.xml, perform mvn eclipse:eclipse and then refresh workspace at the root of the project. The newly-dependent jar package is added to the project's build path.
Go: maven2 Create an Eclipse project, set up M2_repo