问题
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:
- What is the
war/webModule
directory, and what resources go there? - What is
war/webModule/clear.cache.gif
? - 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?) - What's the
war/deploy
directory? If I'm using RequestFactory instead of GWT-RPC do I need it? - Any other "essentials" I'm missing here?
Thanks in advance!
回答1:
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...
来源:https://stackoverflow.com/questions/16804192/gwt-project-directory-creation-by-hand