Skip to Content

Gwt and Maven2

Trying to use Maven2 to build a GWT project, here is the simplest pom.xml I came up with, starting from Xavier’s

The project can be tested in debug mode with mvn gwt:gwt. It is tested in deployed mode with mvn jetty:run-war

Don’t forget to provide the gwt-user.jar in src/main/webapp/WEB-INF/lib.

Code legend: Blue parts depend on your project and installation path. Red part is only needed on a Mac. Green part makes it easier to use the Jetty plugin.

<project>
  <properties>
    <google.webtoolkit.home><span style="color:blue">
    /Users/david/Applications/java/gwt-mac-1.4.10/</span>
    </google.webtoolkit.home>
    <google.webtoolkit.extrajvmargs>
    -XstartOnFirstThread
    </google.webtoolkit.extrajvmargs>
  </properties>

  <repositories>
      <repository>
          <id>gwt-maven</id>
          <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo</url>
      </repository>
  </repositories>

  <pluginRepositories>
      <pluginRepository>
          <id>gwt-maven</id>
          <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo</url>
      </pluginRepository>
  </pluginRepositories>

  <build>
    <plugins>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>com.totsp.gwt</groupId>
        <artifactId>maven-googlewebtoolkit2-plugin</artifactId>
        <version>1.5.1</version>
        <configuration>
            <logLevel>ERROR</logLevel>
            <runTarget>com.valtech.planning.Planning/JnfPage.html</runTarget>
            <compileTarget>com.valtech.planning.Planning</compileTarget>
        </configuration>
        <executions>
            <execution>
                <goals>
                    <goal>compile</goal>
                </goals>
            </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>1.4.10</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-servlet</artifactId>
        <version>1.4.10</version>
    </dependency>
  </dependencies>
</project>
comments powered by Disqus