使用gwt-maven-plugin生成的项目:eclipse

时间:2013-02-15 00:12:12

标签: gwt-maven-plugin

我创建了一个GWT项目 mvn archetype:generate -DarchetypeGroupId = org.codehaus.mojo -DarchetypeArtifactId = gwt-maven-plugin -DarchetypeVersion = 2.5.0

在eclipse juno中导入项目。

我得到的第一个错误是: 生命周期配置未涵盖的插件执行:org.codehaus.mojo:gwt-maven-      插件:2.5.0:i18n(执行:默认,阶段:生成源)

在pom文件中。

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
  <execution>
    <goals>
      <goal>compile</goal>
      <goal>test</goal>
      <goal>i18n</goal>
      <goal>generateAsync</goal>
    </goals>
  </execution>
</executions>
<!-- Plugin configuration. There are many available options, see 
  gwt-maven-plugin documentation at codehaus.org -->
<configuration>
  <runTarget>dashboard.html</runTarget>
  <hostedWebapp>${webappDirectory}</hostedWebapp>
  <i18nMessagesBundle>com.farheap.jsi.dashboard.client.Messages</i18nMessagesBundle>
</configuration>

此外,代码还包含无法找到的GreetingServiceAsync。

private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);

1 个答案:

答案 0 :(得分:3)

您有两种选择:

  1. 你可以添加特殊的(非平凡的)org.eclipse.m2e:生命周期映射插件 配置到您的POM。见这里:Why am I receiving a "Plugin execution not covered by lifecycle configuration with GWT" error?

  2. 或者将此问题标记为在Eclipse POM编辑器中被忽略,然后调用mvn gwt:i18n。你可以为它创造一个方便的捷径发射器。 Eclipse会记住您的决定忽略什么,它会将其永久存储到项目的.settings目录中。

  3. 在典型开发过程中,本地化消息不会经常更改,因此第二个选项通常更方便,并加快构建速度。

    这适用于大多数GWT插件目标!甚至GWT编译也很少需要,因为DevMode直接使用Java代码而不是生成JavaScrips。所以在实践中,你必须在开始时至少召唤一次所有目标,然后在没有它们的情况下过几周;基本的Eclipse JDT编译就足够了。

    如果您以后决定不在真实应用中使用GWT本地化框架,那么您可以完全从POM中删除目标i18n。调用目标i18n会生成(vanilla){project}/target/generated-sources/gwt/my/code/client/Messages.java所需的文件Sample.java

      

    此外,代码还包含无法找到的GreetingServiceAsync。

    从命令行或mvn install菜单运行构建Eclipse Run as -> Maven install。 如果命令行mvn gwt:generateAsync应该足够了。此目标会生成{project}\target\generated-sources\gwt\my\code\client\GreetingServiceAsync.java,这就是您所遗漏的内容。 Eclipse没有自动为您执行此操作,因为之前的 i18n未被生命周期配置覆盖而被阻止。是的,你提到的问题是相关的。

相关问题