2

I am interested in writing a simple GWT application from scratch without the use of the Google Eclipse plugin or the applicationCreator in the GWT SDK. Why? Because I feel like it will help me really learn what these automated tools are doing under the hood, and will help my understand GWT that much better.

I did install the Google Eclipse plugin and used it to create a new Web Application Project (GWT app) just to see what kind of files it auto-generated. For my given project, which has a single module named WebModule (also acting as the sole EntryPoint of the app), here's what the Google Eclipse plugin gave me:

src/main/java
    com.myapp
        WebModule.gwt.xml
    com.myapp.client
        WebModule (implements EntryPoint)
    com.myapp.shared
    com.myapp.server
war/
    webModule/
        lots of folders and files under here...
        clear.cache.gif
        hosted.html
        webModule.nocache.js
    css/
        webModule.css
    hosts/
        webModule.html
    WEB-INF/
        web.xml
    deploy/
        webModule/
            rpcPolicyManifest/
                manifest.txt

So, what I'd like to do is recreate this in another project, but generate everything myself. In order to do that, I need to understand a few things, specifically:

  1. What is the war/webModule directory, and what resources go there?
  2. What is war/webModule/clear.cache.gif?
  3. Is there any way to generate war/webModule/webModule.nocache.js myself? Or do I need to generate that from the command-line with one of the GWT SDK tools? (If so, what/how?)
  4. What's the war/deploy directory? If I'm using RequestFactory instead of GWT-RPC do I need it?
  5. Any other "essentials" I'm missing here?

Thanks in advance!

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
  • 3
    small hint, in just a comment, hoping to follow up later: `war/deploy/` is generated by the build, so skip it. Same with anything in `war/webModule/`, which is named for the `rename-to` in your WebModule.gwt.xml file. Also, for a better handle on doing this by hand in a maintainable way, consider the maven way. – Colin Alworth May 29 '13 at 03:54
  • Thanks @ColinAlworth (+1) - can you elaborate a little on what you mean by "generated by the build"? Do you mean the GWT cross-compiler, or something else? Thanks again! – IAmYourFaja May 29 '13 at 09:23
  • Also, although I'm certainly open to using Maven *eventually*, for now I really do want to do everything manually as much as possible, if for no other reason than to understand the order of events that need to transpire to deploy a working GWT application to a live environment. – IAmYourFaja May 29 '13 at 09:30

1 Answers1

5

1 What is the war/webModule directory, and what resources go there?

This directory is the result of the GTW compiler:

  • files *.cache.html are the versions for each locale and/or browser.
  • *.cache.png are the images resources & sprites used by your application.
  • If you use RPC there is also *.gwt.rpc for the (de)serialization mechanism.
  • If you use a GWT theme, ie the clean theme, you have a gwt subdirectory with css & resources for this theme.

2 What is war/webModule/clear.cache.gif?

This is a 1x1 cacheable image used to have a placeholder for the <img> tag. See http://code.google.com/p/google-web-toolkit/wiki/ImageBundleDesign ("Clipping constructor for Image")

3 Is there any way to generate war/webModule/webModule.nocache.js myself? Or do I need to generate that from the command-line with one of the GWT SDK tools? (If so, what/how?)

*.nocache.js is generated by the GWT compiler. It is the application loader, which will choose the right locale/browser version of your application. It can be generated with the command line tool, an ant build file (see http://developers.google.com/web-toolkit/doc/latest/RefCommandLineTools for an example), or with maven.

4 What's the war/deploy directory? If I'm using RequestFactory instead of GWT-RPC do I need it?

This directory is generated with the -extra or -deploy option. It is files which are NOT deployed in production and contaning technical informations, for example:

  • rpcPolicyManifest: contains metadata about RPC types used, and policies relative files path
  • symbolMaps: data table to retrieve class names and stack trace from the obfuscated javascript files.

So I think if you don't use RPC, maybe you even need it to have unobfuscated traces.

5 Any other "essentials" I'm missing here?

You can find more details here: https://developers.google.com/web-toolkit/doc/latest/DevGuideCompilingAndDebugging

Hope this help...

Philippe Gonday
  • 1,747
  • 5
  • 21
  • 32
  • Thanks @philfr49 (+1) - so it sounds like, as long as I use the Ant tasks to run the GWT compiler as part of my Ant build, I should be able to produce a GWT-compliant WAR myself with nothing more than Ant and the GWT compiler. Is this correct? And thanks again on an awesome and thorough answer! – IAmYourFaja May 31 '13 at 15:19
  • I never try to create the directories by hand (I use the eclipse plugin to create a new project), but i use ant build file without pb. – Philippe Gonday Jun 04 '13 at 06:37