GWT 1.6 Build Migration

April 8, 2009 at 9:11 pm | Posted in Build, Java, Software Development, Web | 2 Comments
Tags: , , , , , , ,

GWT 1.6 final officially got released yesterday. Most of you guys probably already have a GWT application sitting around that you want to upgrade from 1.5 to 1.6 to fully leverage the new features. One of the biggest changes is the structure of the WAR file. The public directory that got generated in 1.5 by running the projectCreator and applicationCreator tools does not exist anymore. HTML and CSS files will sit in the root directory of your WAR file. To convert your project have a look at the proposed project structure and apply it to your project. In your Ant build file you might have something similar to this one (assume that the WAR file got build before in a different target):

<path id="gwt.classpath">
   <pathelement location="src"/>
   <fileset dir="${libs.dir}/gwt/gwt-1.5.3">
      <include name="gwt-user.jar"/>
      <include name="gwt-dev-linux.jar"/>
      <include name="gwt-dev-mac.jar"/>
      <include name="gwt-dev-windows.jar"/>
   </fileset>
</path>

<target name="compile-gwt">
   <java classname="com.google.gwt.dev.GWTCompiler" fork="true">
      <arg line="-out ${gwt.compile.out}" />
      <arg value="${gwt.module}" />;
      <arg line="-style ${gwt.style}" />
      <classpath refid="gwt.classpath"/>
   </java>
</target>

<target name="gwtify-war">
   <!-- We don't need the GWT compiler tmp files-->
   <delete dir="${gwt.compile.out}/.gwt-tmp"/>
      
   <zip destfile="${operations-consoleweb.path.jar}" update="true">
      <fileset dir="${gwt.compile.out}">
         <include name="**/*.*"/>
      </fileset>
   </zip>
</target>

With the new version of the GWT compiler the temporary directory .gwt-tmp, as a by-product of the compilation process, is not being generated anymore. Use the new compiler class name com.google.gwt.dev.Compiler and you should be done.

<path id="gwt.classpath">
   <pathelement location="src"/>
   <fileset dir="${libs.dir}/gwt/gwt-1.6.4">
      <include name="gwt-user.jar"/>
      <include name="gwt-dev-linux.jar"/>
      <include name="gwt-dev-mac.jar"/>
      <include name="gwt-dev-windows.jar"/>
   </fileset>
</path>

<target name="compile-gwt">
   <java classname="com.google.gwt.dev.Compiler" fork="true">
      <classpath>
         <path refid="operations-console.module.sourcepath"/>
         <path refid="gwt.classpath"/>
      </classpath>
      <jvmarg value="-Xmx256M"/>
      <arg value="${gwt.module}"/>
   </java>
</target>
Advertisements

2 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Can you please explain to me haw to setup gwt1.6.4 throwout an example project. I used yet gwt1.5.3 but when I have to migrate to the new version I have a problem to run examples.
    Thx

    • GWT 1.6.4 has a new project structure. Make sure you have your HTML/CSS in the “war” directory. Also the compiled GWT files have to go under that directory. GWT libraries have to go in “war/WEB-INF/lib”, web.xml in “war/WEB-INF”. What’s your IDE? Do you use a GWT plugin? If you’re using Eclipse definitely go for the Google plugin. It will help you set up a GWT project from scratch correctly. Do you get a specific error message when trying to run the example? Are you running the example in hosted mode or in a separate web container?


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: