maven project 转化为eclipse project

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

你可能感兴趣的:(eclipse,maven,xml,JUnit,ide)