Maven, GWT and Eclipse project

寵の児 提交于 2019-12-23 02:33:45

问题


I'm trying to setup new web project using newest Maven, GWT and Eclipse. I'm trying to generate it with available archetype from GWT Maven Plugin with command:

mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.4.0 -DarchetypeRepository=repo1.maven.org

Running mvn gwt:run builds project, appication starts and everything seems to be ok. The problem appears when I'm trying to import this project as "Maven Project" into Eclipse Indigo. I'm getting mvn warning

Description Resource Path Location Type maven-war-plugin goals "inplace", "exploded", "manifest" are ignored by m2e pom.xml /contactmanager line 93 Maven Project Build Lifecycle Mapping Problem

and many Java errors like

  • Resource Path Location Type GreetingService cannot be resolved to a type GwtTestContactManager.java /contactmanager/src/test/java/com/jeffmaury/contactmanager/client

  • Missing asynchronous interface GreetingServiceAsync

It seems like something has changed and the newest gwt, m2eclipse, eclipse indigo and mvn can't work together properly.

Is there any way to fix this basic GWT project after importing into Eclipse? And to run this generated application from IDE?

Btw I've followed also many tutorials (e.g. http://riadiscuss.jeffmaury.com/2011/06/tutorial-maven-gwt-plugin-google.html) but without success. Almost all of them were deprecated...


Thanks.


回答1:


Can you try adding something like this in your projects pom:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-war-plugin</artifactId>
                                    <versionRange>[2.0,)</versionRange>
                                    <goals>
                                        <goal>inplace</goal>
                                        <goal>exploded</goal>
                                        <goal>manifest</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>



回答2:


maven and gwt are a real pain to get right.... I think the various plugins cause more problems than they solve...

I use mvn eclipse:eclipse to create the eclipse files after the project is created

Then to debug

mvn gwt:debug

which starts hosted mode outside of eclipse and listening at port 8000 for debugger connections...

and then debug by connecting to the remote application from eclipse....

Im not 100% sure if I created my projects the way you describe... I think so but its been a while



来源:https://stackoverflow.com/questions/10789143/maven-gwt-and-eclipse-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!