David Conde's Blog

17Feb/081

Maven2 and GWT

I was doing some playing with GWT over the weekend and had a few issues generating some nice javascript based GUI's using maven2. Below you'll find the pom that ended up doing the job for me :D

<project>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>gwt-test</artifactId>
    <name>gwt-test</name>
    <groupId>eu.javadeveloper.gwt-test</groupId>
    <version>0.1</version>
    <packaging>war</packaging>
    <properties>
        <maven.test.skip>true</maven.test.skip>
        <gwt.version>1.4.61</gwt.version>
    </properties>
 
    <dependencies>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwt.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
 
    <build>
        <plugins>
            <plugin>
                <groupId>com.totsp.gwt</groupId>
                <artifactId>maven-googlewebtoolkit2-plugin</artifactId>
                <configuration>
                    <gwtVersion>${gwt.version}</gwtVersion>
                    <logLevel>ERROR</logLevel>
                    <runTarget>gwt.Test.html</runTarget>
                    <compileTargets>
                        <value>eu.javadeveloper.gwt.GWTTest</value>
                    </compileTargets>
                    <sourceDirectories>
                        <param>${basedir}/src/main/java</param>
                    </sourceDirectories>
                    <output>${basedir}/target/gwt-test</output>
                </configuration>
                <executions>
                    <execution>
                        <id>setup-gwt</id>
                        <goals>
                            <goal>setup</goal>
                            <goal>extractGwt</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>compile-gwt</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
 
    <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>
</project>
Filed under: GWT, Maven2 Leave a comment
Comments (1) Trackbacks (0)
  1. To be honest – I never used gwt-maven integration. I use GWT Maven plugin from Mojo: http://mojo.codehaus.org/gwt-maven-plugin/

    First of all – they auto discovers GWT modules. You don’t have to add additional configuration – just execution with specified goal. Version 1.2-SNAPSHOT of gwt-maven-plugin also supports GWT 2.0.


Leave a comment

(required)

No trackbacks yet.