Saturday, September 13, 2008

Setting up a new GWT project - part 1

Below are steps I took to set up a new GWT project. I realize that this is not a simple step-by-step instruction that someone may follow, but hopefully it will help you in some way. 

  • Create a new Java project in Eclipse 
  • Create Maven2 pom.xml with all dependencies you may need
Maven gathers all the required jars and builds the war file that will be copied to the Tomcat.
  • Ant build.xml file:
Ant file coordinates all tasks into simple "single-click".  

    <target name="war" depends="clean">

    <echo>Maven Executable: ${MAVEN_EXEC}echo>

    <exec taskname="mvn war" dir="${basedir}"

    executable="${MAVEN_EXEC}">

    <arg line="clean compile war:war -Dtarget=${TARGET}" />

    exec>

    <delete file=".\\target\\csd.war" />

    target>


    name="gwt_shell" depends="war">

    <echo>GWT: starting hosted (dev)echo>

    <java taskname="GWT hosted" classpathref="class_path"

    classname="com.google.gwt.dev.GWTShell" fork="true"

    maxmemory="512m">

    <jvmarg line="-verbose ${JVM_ARG_START}" />

    <arg line="-out www com.taktico.Main/Main.html" />

    java>

    target>


    <target name="gwt_compile_to_js" depends="war">

    <java taskname="GWT compile" classpathref="class_path"

    classname="com.google.gwt.dev.GWTCompiler" fork="true"

    maxmemory="512m">

    <jvmarg line="-verbose ${JVM_ARG_START}" />

    <arg line="-logLevel WARN -out www com.taktico.Main" />

    java>

    target>


  • Properties file in src/main/resources (uki.properties)

    DEPLOY_DIR = /usr/local/tomcat/webapps/csd/

    GWT_HOME=/opt/gwt/gwt-mac-1.5.1/

    JVM_ARG_START = -XstartOnFirstThread

    MAVEN_EXEC=/opt/maven/apache-maven-2.0.9/bin/mvn



  • Add  src/com/taktico/public/Main.html
  • Add src/com/taktico/Main.gwt.xml




If you can see the HTML  it is a great time to take a break, good job!

If you need a weekend tutoring on any of the subjects mentioned I might be available on weekends for a very reasonable fee plus travel expense if outside the Chicago area, contact: UkiDLucas@mac.com

Please leave a comment.