Eclipse 每次我更改源文件(GWT)时都会调用Maven Project Builder
最近,我将我的GWT web应用程序(GWT2.4.0)转换为一个maven项目。Eclipse 每次我更改源文件(GWT)时都会调用Maven Project Builder,eclipse,gwt,maven,m2eclipse,Eclipse,Gwt,Maven,M2eclipse,最近,我将我的GWT web应用程序(GWT2.4.0)转换为一个maven项目。 我正在使用maven 2.2.1(2.4.0)、EclipseIndigo(3.7)和m2eclipse插件 依赖项和常规配置似乎很好,因为web应用程序在编译时没有任何问题,并且可以在生产模式下工作。 这同样适用于托管模式 然而,我有一个奇怪的行为:当我更改Java/GWT源文件中的一行时,会调用Maven Project Builder,这一步骤耗时很长(大约10秒),eclipse有时在这段时间内变得不可用
我正在使用maven 2.2.1(2.4.0)、EclipseIndigo(3.7)和m2eclipse插件 依赖项和常规配置似乎很好,因为web应用程序在编译时没有任何问题,并且可以在生产模式下工作。
这同样适用于托管模式 然而,我有一个奇怪的行为:当我更改Java/GWT源文件中的一行时,会调用
Maven Project Builder
,这一步骤耗时很长(大约10秒),eclipse有时在这段时间内变得不可用
这是m2eclipse的正常行为吗?
如果是,有没有办法加快速度?
注意:我必须为m2eclipse配置生命周期插件。以下是pom文件的重要部分:
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>index.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>com.gmi.nordborglab.testapp.client.Messages</i18nMessagesBundle>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<versionRange>[2.4.0,)</versionRange>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<versionRange>[2.1.1,)</versionRange>
<goals>
<goal>exploded</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
${webappDirectory}/WEB-INF/classes
org.codehaus.mojo
GWTMaven插件
2.4.0
编译
测试
index.html
${webappDirectory}
com.gmi.nordborglab.testapp.client.Messages
org.apache.maven.plugins
maven战争插件
2.1.1
编译
爆炸了的
${webappDirectory}
org.eclipse.m2e
生命周期映射
1.0.0
org.codehaus.mojo
GWTMaven插件
[2.4.0,)
资源
编译
org.apache.maven.plugins
maven战争插件
[2.1.1,)
爆炸了的
Maven构建的原因很可能是启用了Maven项目生成器(项目属性>生成器)
您可以禁用它,只要选择了Java Builder,Eclipse将继续编译编辑过的文件。我通常取消选中: 项目|自动生成
我只是讨厌一直编译它。这完美地说明了为什么m2e默认情况下不让任何“未知”插件在增量构建上运行()。大多数maven插件不适合增量构建,并且在调用它们时都会进行完整构建(另外,您可能会遇到类加载器泄漏) 在插件管理部分,您指定应执行gwt:resources、gwt:compile和war:exploded。默认情况下,它们是在增量构建上执行的,这意味着每次资源更改时都会执行。由于这些目标/插件没有针对增量构建进行优化,它们需要一段时间才能完成 如果您想加快速度,您可以使用
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
假的
然后,手动执行EclipseClean构建将自动触发它们的执行
我相信(但可能是错误的)如果你使用Google Eclipse插件,你可以完全忽略gwt:resources和gwt:compile(替换为)。Eclipse和Java的强大功能在一个动作中就被摧毁了:-)。我喜欢一直编译所有的东西,而不喜欢不编译的东西(比如gwt)。这迫使我为一个值得的大项目写了一些类似GWT的东西。它只花了2周时间,而且工作做得完美无缺。如果你处理的是大项目,那可能会很烦人。我在Eclipse中取消选中的第一件事是一个有趣的想法。你如何触发完整的构建?使用pom.xml>运行方式?@MartinKersten:Yes、 如果我没有记错Eclipse。我已经两年多没有使用它了:-PrunOnIncremental默认为false。您的更改没有任何作用。请澄清这一点,因为您是一名m2e提交人。我在此处阅读了关于false默认为false的内容: