`
Anddy
  • 浏览: 191590 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

maven project 转化为eclipse project

    博客分类:
  • java
阅读更多

There is actually a very easy solution for this. The mavenS W "eclipse:eclipse" goal will download any necessary dependencies and will update our project's .classpath to include these dependencies. The maven command using the eclipse:eclipse goal would be

mvn eclipse:eclipse

导入到eclipse ide后,项目有个红色的感叹号,看起来很碍眼。原因在于java bulid path出问题。

 

The maven eclipseS W plugin requires an M2_REPO classpathW variable. This variable needs to point to the local maven repository. On my machine, this is located at C:\dev\m2repo. I went to Window → Preferences and JavaS W → Build Path → Classpath Variables. I clicked the New button and created the M2_REPO classpath variable and pointed it to my local maven repository.

 

生成的eclipse项目的配置文件.classpath 中如下一段代码:

 

<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>

 所以有了上面提到配置变量M2_REPO.才能找到这个junit包。这个版本是不是太低了?修改pom.xml可以以高版本覆盖之。

 

至此,

 

参考文档:

 

http://www.avajava.com/tutorials/lessons/how-do-i-import-a-maven-project-into-eclipse.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics