4

I am having a lot of problems trying to create a simple GWT + Maven project that can be used from within Eclipse. Here's what I'm doing:

  1. Create a new gwt-maven-plugin project:

    mvn archetype:generate -q -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0-rc2 -DgroupId=myGroupId -DartifactId=myArtifactId -Dversion=1.0 -Dmodule=myModule
  2. Open the project in Eclipse: File => Import... => Existing Maven Projects, then select the project I just created.

However, I get these errors:

No marketplace entries found to handle gwt-maven-plugin:2.5.0-rc2:generateAsync in Eclipse.  Please see Help for more information.
No marketplace entries found to handle gwt-maven-plugin:2.5.0-rc2:i18n in Eclipse.  Please see Help for more information.

I don't understand this error message. I've found a related question on SO, but adding the suggested snipped to my pom.xml didn't appear to do anything.

Can anyone shed some light?

Community
  • 1
  • 1
del
  • 6,341
  • 10
  • 42
  • 45
  • Have you tried Project → Maven → Update project configuration… ? BTW, I don't recommend using the archetype. See http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven – Thomas Broyer Oct 25 '12 at 08:15
  • Updating the project configuration didn't fix the problem. The tutorial you linked looks promising, I'll give it a go. – del Oct 26 '12 at 02:56
  • Doesn't Eclipse propose you "quick fixes" for those errors? It should propose you to ignore them, for which it'll insert the appropriate configuration (similar to the one from Dvd Prd's answer) in the `pluginManagement` section of your POM. – Thomas Broyer Oct 26 '12 at 08:45
  • @ThomasBroyer Thomas, the WorkingWithMaven guide suggests using starter pom configs, but all the poms use request factory. Is there a leaner pom that provides the bare necessities for an RPC GWT app? – David Mann Aug 15 '13 at 20:53
  • 1
    http://github.com/tbroyer/gwt-maven-archetypes among many many others. I'm almost certain some samples use RPC though (validation maybe?) – Thomas Broyer Aug 16 '13 at 22:09

2 Answers2

1

You should tell m2e to just ignore these warnings. Once you execute a goal the async & i18n goals are automatically executed its just a classic case of maven / eclipse not playing nice together.

Append the pluginManagement in your build section of the project (after the plugins element)

   <plugins>
          your  maven plugins here
    </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <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>i18n</goal>
                                            <goal>generateAsync</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

Finally add the folder target/generated-sources/gwt to the build path

David
  • 4,185
  • 2
  • 27
  • 46
  • 1
    This removes these 2 import errors, but then I get a bunch of build errors referring to missing types: "Messages cannot be resolved to a type", "GreetingServiceAsync cannot be resolved to a type", "The method create(Class>) from the type GWT refers to the missing type Messages", etc. – del Oct 26 '12 at 02:30
  • Make sure you add the target/generated-source/gwt folder to the buildpath. This will make eclipse find the generated classes. – David Oct 26 '12 at 07:11
0

Instead of running from command line, install eclipse m2e (Maven Integration for Eclipse) plugin. This will make your life a lot easier.

UPDATE: Check this one out Maven GWT 2.0 and Eclipse

Community
  • 1
  • 1
Eugene Ryzhikov
  • 17,131
  • 3
  • 38
  • 60
  • 1
    m2e does an amazingly slick job of getting Maven and Eclipse to talk together – Nathaniel Waisbrot Oct 25 '12 at 04:36
  • Obviously the OP is already using M2Eclipse: `No marketplace entries found…` kind of messages come from M2E. – Thomas Broyer Oct 25 '12 at 08:16
  • @eugener - I am using mvn from the command line just to create a simple example project. I am having problems trying to import any Maven + GWT project into Eclipse (with m2e installed). – del Oct 25 '12 at 23:57