Translate

неділя, 6 березня 2011 р.

How to create gwt maven project?


How to create gwt maven project? Easy! Just run

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

This maven plugin generates project based on GWT version 2.1.0  If you prefer to use version 2.2.0, just replace version in pom.xml. Then the following compilation error will occur

java.lang.NoClassDefFoundError: com/google/gwt/core/ext/GeneratorExt
[INFO] at java.lang.ClassLoader.defineClass1(Native Method)
[INFO] at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
[INFO] at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

You should add dependency on gwt-dev.jar

<dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-dev</artifactId>
        <version>2.2.0</version>
        <type>jar</type>
        <scope>compile</scope>
</dependency>
By maven-googlewebtoolkit2-plugin