开发者

compile time properties passed to runtime client side GWT?

I have a GWT project set up with multiple module files (they inherit a base module to override logging and compression settings and the like) that I use with maven profiles to control staging/production/development config... I would like to be able to add some runtime configuration (like web service/rpc endpoints and other stuff I need swapped out for my various environments) in this same way, but it doesn't look like there is a smart way to get at those prope开发者_运维百科rties... is there a right way to do this with GWT or should I just roll something myself with maven/ant and property files?


If you need to hook into the GWT compilation process, check out Generators and Linkers. The GWT build process is divided into two phases. Compilation and linking. Generators tab into the compilation phase, linkers into the linking phase.

Generators are called during the GWT compilation and can be used to create additional resources, things like classes, properties files and so forth. The generator is called withing the GWT compiler context, thus you can access environment information which are only available during compile time in your generator:
http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/gwt/core/ext/Generator.html

Linkers are responsible to packages the resources. A linker can be include in the build process to create custom package of the compiler output:
http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/gwt/core/ext/Linker.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜