2012-02-13 69 views
0

从阅读A Java web project created with Maven is not recognized as such by EclipseWTP的依赖性似乎并不奏效

我添加了以下插件的pom.xml我的Maven项目转换为一个web项目:

<plugins> 
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-eclipse-plugin</artifactId> 
     <configuration> 
      <wtpmanifest>true</wtpmanifest> 
      <wtpapplicationxml>true</wtpapplicationxml> 
      <wtpversion>2.0</wtpversion> 
     </configuration> 
    </plugin> 
</plugin> 

我然后运行“更新项目配置“,但maven项目不会转换为Web项目。

如果我运行命令mvn eclipse:eclipse -Dwtpversion=2.0,那么项目会被更新。更新.pom文件不足以将maven项目转换为Web项目?

回答

0

这是不够的。插件配置需要执行,这不会在Eclipse中加载/刷新它。它在mvn eclipse:eclipse运行时得到执行。

我假设我们没有m2e,它不需要这个配置。

+0

我有m2e,但部署到tomcat我需要将项目转换为Web项目,为什么我不需要这种配置? – 2012-02-13 11:08:15

+0

@ user470184。 m2e不使用maven-eclipse-plugin中的信息。它基于'packaging'类型自动检测项目。你会想要安装m2e wtp集成。 – Raghuram 2012-02-13 11:26:17

+0

m2e&maven-eclipse-plugin是不是一样的插件? – 2012-02-13 11:40:02