简体   繁体   中英

Setting up GWT project with maven in Eclipse

I am trying to set up a maven project in Eclipse using Maven. What I have tried so far:

  1. creating the project in Eclipse by creating a new Maven project and selecting the org.codehouse.mojo gwt-maven-plugin in version 2.7.0.

The problem: - Eclispe doesn't offer me any run configuration

So I went to the properties of the project, to the Google tab, pointed Eclipse to the webapp folder and checked the chedkbox that says "Use Google Web Toolkit".

After that, Eclipse did recognize my project as a GWT project, however, it added several jars to my build path (which I think shouldn't be necessary because I'm using Maven and the same jar are already listed as maven dependencies) and when I run it in Super Dev Mode, I get this error:

Missing required argument 'module[s]'
Google Web Toolkit 2.7.0

Also, when I rightlick and choose Google > GWT Compile, it tells me that my project isn't a GWT project.

  1. I created the project using the command line:

    mvn archetype:generate

    org.codehaus.mojo:gwt-maven-plugin

    Choose archetype:

    1: remote -> org.codehaus.mojo:gwt-maven-plugin (Maven plugin for the Google Web Toolkit.)

    Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1

    org.codehaus.mojo:gwt-maven-plugin version:

    23: 2.7.0

The project was successfully generated, I imported it as maven project into Eclipse. Again, Eclipse doesn't recognize it as a GWT project.

  1. I wanted to create a project with the 2.8.0 archetype from here:

https://gwt-maven-plugin.github.io/gwt-maven-plugin/user-guide/archetype.html

However, I get this error:

mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.8.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [org.codehaus.mojo:gwt-maven-plugin:2.7.0] found in catalog remote
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.449 s
[INFO] Finished at: 2015-11-14T23:47:50+01:00
[INFO] Final Memory: 13M/182M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.codehaus.mojo:gwt-ma
ven-plugin:2.8.0-SNAPSHOT) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

What exactly am I doing wrong?

Pls give this a try:

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

Tested in Jdk 1.7 and Maven 3.3.9 environment and Eclipse Mars with latest Google GWT Plugin.

You are using wrong version of gwt maven plugin. 2.8.0-SNAPSHOT version is not available at maven repository.

See the link below to find the released versions of plugin at maven repository. http://mvnrepository.com/artifact/org.codehaus.mojo/gwt-maven-plugin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM