分类: Java
2011-11-09 11:36:08
在前一篇文章中,我们使用maven创建了一个java 项目, 但是这个项目不能导入 Eclipse IDE, 因为它不是 Eclipse style的项目。
Here’s a guide to show you how to convert the Maven generated Java project to Eclipse supported style project.
After that, you will notice two new files are created – “.classpath” and “.project“. Both files are created for Eclipse IDE.
File : .classpath
Wait, M2_REPO !?
Did you notice a “M2_REPO” classpath variable is generated? For first time, you have to . Otherwise, Eclipse will raise error about your imported project later.
当然,如果你已经安装了maven eclipse插件,那就很简单了。window>Preferences>Maven>Installations>Add(添加你的maven安装位置)
如果你没有安装Maven插件,按以下方法添加M2_REPO:
Define and add M2_REPO classpath variable manually to Eclipse IDE. Follow below steps :
Done.
File : .project
3. Import into Eclipse IDE
Now, import it into Eclipse IDE, follow below steps :
In Eclipse IDE, menu bar , File -> Import… -> General -> Existing Projects into Workspace -> select root directory (select your project folder) -> Done.
谢谢访问!