Pages

May 11, 2010

Maven archetype for GWT application

This is simple archetype based on archetype bundled with (org.codehaus.mojo) gwt-maven-plugin. In opposite to archetype from that plugin, this one uses only one web.xml file stored in webapp/WEB-INF directory. Directory war (created in Development Mode) can be removed by clean goal as it's content is copied from appropriate directories when needed (maven-clean-plugin is already configured to do this). At this moment archetype is configured to use GWT 2.0.3 but it works also with earlier versions.

Usage

Source code for this archetype is available from Mercurial repository:
http://bitbucket.org/ajurzyk/gwt-app-archetype

If you have Mercurial in your system, you can clone whole repository:
$ hg clone http://bitbucket.org/ajurzyk/gwt-app-archetype
or simply download latest snapshot of code in zip file.

Enter directory with downloaded sources and execute:
$ mvn install
to install archetype in your local Maven repository.
After succesfull instalation, you can delete source files as their are no longer needed.

To generate GWT application use standard archetype:generate command:
$ mvn archetype:generate \
   -DarchetypeGroupId=com.ajurzyk \
   -DarchetypeArtifactId=gwt-app \
   -DarchetypeVersion=1.0 \
   -DgroupId=your.package.name \
   -DartifactId=your.artifact.id

Enter created directory (your.artifact.id) and execute:
$ mvn gwt:run

For details about gwt-maven-plugin usage check http://mojo.codehaus.org/gwt-maven-plugin