对于 Eclipse,我使用:m2eclipse 插件 (1.0)。它适用于一两件小事。还可以下载 m2eclipse-extras 插件以添加 SVN 功能和 Maven(或 CVS,如果您愿意)。
当您下载项目时,它会读取 pom.xml 并 [重新] 创建 Eclipse 配置文件,如 mvn eclipse:eclipse 命令。
对于 GWT……我也用过。这是一个非常复杂的配置,但它可以工作。我使用 GWT 2.0.3,maven-gwt-plugin 使用依赖项来工作(没有对 GWT SDK 的引用),它可以从 Eclipse 进行调试,这简直太棒了。
你必须编译到一个战争目录(不是目标/类标准)。但是细节在我的工作中,所以让我明天看看并完成这个答案:) 不要放弃。拥有 GWT+Eclipse+Maven 真是太好了。
编辑:我的配置的一部分
<build>...
<outputDirectory>war/WEB-INF/classes</outputDirectory>
...
</build>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<gwtVersion>${gwt.version}</gwtVersion> <!-- para forzar que use el de maven y no el SDK instalado -->
<disableCastChecking>true</disableCastChecking>
<disableClassMetadata>true</disableClassMetadata>
<runTarget>/subscriber/listSubscribers.htm</runTarget>
<webappDirectory>${basedir}/war</webappDirectory>
<soyc>true</soyc>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- dont know/remember if the jetty inside the gwt uses this... but it doesnt hurt-->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.14</version>
<configuration>
<webAppConfig>
<contextPath>/magazine</contextPath>
<baseResource implementation="org.mortbay.resource.ResourceCollection">
<resourcesAsCSV>
${basedir}/src/main/webapp,
${basedir}/war
</resourcesAsCSV>
</baseResource>
</webAppConfig>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8888</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<scanIntervalSeconds>3</scanIntervalSeconds>
<scanTargets>
<scanTarget>${basedir}/war</scanTarget>
</scanTargets>
</configuration>
</plugin>
与
为了调试,我创建了两个任务:
1) 运行两个目标的 Eclipse 内的 maven 构建:war:exploded gwt:debug
- 第一个将所有资源复制到war目录中,供gwt调试使用。
- 接下来 gwt 准备就绪。
也许你需要第一次执行gwt:compile
2) Java 远程应用程序调试配置,选择您的项目。
当 gwt:debug 是“监听 8000 端口”时运行此配置
AND:这是在父 pom.xml 中(抱歉,我稍后会编辑这篇文章 :)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
<configuration>
<warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
<webappDirectory>${basedir}/war</webappDirectory>
<warName>${artifactId}</warName>
</configuration>
</plugin>