2
votes

I created a GWT project with mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0

Imported the project in eclipse juno.

First error I get is this : Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:gwt-maven- plugin:2.5.0:i18n (execution: default, phase: generate-sources)

In the pom file.

<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>

Also the code contains a GreetingServiceAsync that can not be found.

private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
1
I fixed the plugin error with this :klind

1 Answers

3
votes

You have two options:

  1. You can add special (non-trivial) org.eclipse.m2e:lifecycle-mapping plugin configuration to your POM. See here: Why am I receiving a "Plugin execution not covered by lifecycle configuration with GWT" error?

  2. Or mark this issue as to be ignored in Eclipse POM editor, and then call mvn gwt:i18n. You can create a handy short cut launcher for it. Eclipse remembers your decisions what to ignore, it stores it into .settings directory permanently for the project.

In course of typical development localization messages do not change often so the second option is usually more convenient and speeds up build.

This applies for most GWT plugin goals! Even GWT compilation is rarely necessary as DevMode works directly with Java code and not generated JavaScrips. So in practice, you have to call all the goals at least once on the beginning and then live weeks without them; basic Eclipse JDT compilation is sufficient.

If you later decide not to use GWT localization framework in your real app then you can remove goal i18n completely from POM. Calling goal i18n generates file {project}/target/generated-sources/gwt/my/code/client/Messages.java which is required by (vanilla) Sample.java.

Also the code contains a GreetingServiceAsync that can not be found.

Run the build mvn install from command line or Eclipse Run as -> Maven install menu. In case of command line mvn gwt:generateAsync should be enough. This goal generates {project}\target\generated-sources\gwt\my\code\client\GreetingServiceAsync.java and that is what you missing. Eclipse did not do it for you automatically because it was blocked by previous issue of i18n not being covered by lifecycle configuration. So yes, issues you mention are correlated.