开发者

GWT Maven integration

开发者 https://www.devze.com 2023-02-03 06:57 出处:网络
Can somebody guide me on how to integrate Maven with GWT or point t开发者_运维知识库o a good, workable tutorial?

Can somebody guide me on how to integrate Maven with GWT or point t开发者_运维知识库o a good, workable tutorial?

I am using GWT 2.1, Eclipse 3.6 Helios


There's a Maven GWT plugin/mojo that you can use along with an archetype that will generate some sample code (which you can get rid of easily). The documentation on the site is fairly decent http://mojo.codehaus.org/gwt-maven-plugin/

Also, I faced several problems while trying to build a WAR and get it deploy successfully on tomcat. I found this discussion on the forum to be extremely useful. The OP on this even posted a working POM

https://groups.google.com/d/topic/google-web-toolkit/j8Jgp4ZQduk/discussion


Here's a baseline POM for a GWT project in Maven:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>myCompany</groupId>
  <artifactId>myModule</artifactId>
  <packaging>war</packaging>
  <name>My GWT App</name>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <gwtVersion>2.1.0</gwtVersion>
  </properties>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>      
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.1.0-1</version>
        <configuration>
          <module>com.myCompany.myModule</module>
        </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>${gwtVersion}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>

The GWT Maven Plugin has a lot of additional functionality - see the project documentation for more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消