Friday, June 6, 2008

Upgrading to GWT 1.5 M2 with Maven 2 and hibernate4gwt


SUMMARY:

After the upgrade from GWT 1.4 to 1.5 the app starts correctly and works, but I feel that it is not optimized and takes more memory, takes longer to start and makes the browser to time out: 


I get a lot of "deprecated" warnings in the console. Probably cleaning these would help to speed things up:

[WARN] Deprecated use of gwt.typeArgs for parameter teamGameList; Please use java.util.List<com.ucc.csd.dto.TeamGameDTO> as the parameter's type

Overall, we will wait for the next release of GWT and observe the message boards.


HOW TO DO IT - TUTORIAL:

Download the GWT 1.5 M2.
Downloaded new hibernate4gwt.

GWT_HOME = /opt/gwt/gwt-mac-1.5M2




Run the following to add it to the Maven 2 repository:

mvn install:install-file -DgroupId=com.google.gwt -DartifactId=gwt-user -Dversion=1.5-m2 -Dpackaging=jar -Dfile=/opt/gwt/gwt-mac-1.5M2/gwt-user.jar

mvn install:install-file -DgroupId=com.google.gwt -DartifactId=gwt-servlet -Dversion=1.5-m2 -Dpackaging=jar -Dfile=/opt/gwt/gwt-mac-1.5M2/gwt-servlet.jar 

mvn install:install-file -DgroupId=net.sf.hibernate4gwt -DartifactId=hibernate4gwt -Dversion=1.0.4b_GWT_1.5_M2 -Dpackaging=jar -Dfile=/opt/gwt/hibernate4gwt-1.0.4b_GWT_1.5_M2/dist/hibernate4gwt-1.0.4b_GWT_1.5_M2.jar




The pom.xml will have these entries:

<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>1.5-m2</version>
</dependency>

<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>1.5-m2</version>
</dependency>

<dependency>
<groupId>net.sf.hibernate4gwt</groupId>
<artifactId>hibernate4gwt</artifactId>
<version>1.0.4b_GWT_1.5_M2</version>
</dependency>

I had to increase the maxmemory. I run everything from ant:

<target name="hosted" depends="war">
<echo>GWT: starting hosted (dev)</echo>
<java taskname="GWT hosted" classpathref="class_path" classname="com.google.gwt.dev.GWTShell" outputproperty="www" fork="true" maxmemory="512m">
<jvmarg value="-verbose" />
<jvmarg value="${JVM_ARG_START}" />
<arg value="com.ucc.csd.CSD/CSD.html" />
</java>
</target>