Suppose I want to create some library code which could be shared across multiple GWT modules.
What is the typical method for reusing this library. Should I create a module for the library, and then import it inside my .gwt.xml file? Is there any way to release it as a jar?
Do it the way you would do any module. It doesn't have to be a web app, no additional configuration files are needed. Just sources packed up into jar file. The only real requirements are:
*.gwt.xml
descriptor file in root dir of your module.client
package for classes that are intented to be compiled to js and server
for the rest.What is interesting, if your module does not depend on any GWT-specific classes or use jsni, you can use it with "normal" java applications as well.
The answer to the second question (how to reuse it) is simple: add newly created jar to your classpath and inherit this module in module descriptor of your web app.
And yes, once you have it in a jar, you can release it ;-)
The perfect example of such approach is Ext GWT (aka GXT): http://www.sencha.com/products/extgwt/ just download this library, unpack and see setup.txt
for installation instructions and how is gxt.jar
(a reusable module) done.
You need to create GWT modules:
See this tutorial: GWT Tutorial – Using and creating modules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With