GWT using maven2

I was trying to set up gwt with maven2. And here is tutorials how to do it.

We will use little help. There is already gwt archetype for maven2. (you don’t have to use it. You are fine with maven default war project archetype but set up your project correctly)

  1. Download this file (it is for version 1.4.59, but by changing the pom you can get the newest version (which is at the time of writing 1.4.61)
  2. unzip file
  3. install it to your repository “mvn install”

Use the archetype to create maven gwt skelet.

mvn archetype:create -DarchetypeGroupId=com.totsp.gwt -DarchetypeArtifactId=gwt-archetype -DarchetypeVersion=1.0-SNAPSHOT -DartifactId=gwt-using-archetype

Next we will modify pom.xml

  • change version for gwt-user and gwt-servlet (at the time of writing it is 1.4.61)
  • change element <compileTarget> to <compileTargets> also for closing element </compileTargets>
  • last thing is to tell where is your gwt installation. So add <gwtHome> element (here is example:

This is very “hardcoded” and it is suggest to define it in ~/.m2/settings.xml (use either way) and here is example of settings.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
     <!–- XstartOnFirstThread needed only on the mac -–>

OK and now we are ready to try our example. Run ‘mvn gwt:gwt’ and it will launch browser with your application. By using archetype you are up and running in few minutes.

If you want to integrate it with jetty just run ‘mvn jetty:run-exploded’ and open localhost:8080.

Few tips:

  • polish tutorial with little bit different approach
  • tutorial I studied from
  • Multi project in maven with GWT – use svn to check out code on your local computer and run it

Source code can be downloaded from here.

One Comment on “GWT using maven2”

  1. […] GWT using maven2 April 2008 4 […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s