Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Way to Build Library Code [closed]

Tags:

gwt

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?

like image 525
Kevin Dolan Avatar asked Feb 04 '11 18:02

Kevin Dolan


2 Answers

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:

  1. Follow module creation guidelines:
    1. Prepare a *.gwt.xml descriptor file in root dir of your module.
    2. Have a client package for classes that are intented to be compiled to js and server for the rest.
  2. Be sure to include sources in jar file.

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.

like image 103
genobis Avatar answered Sep 24 '22 22:09

genobis


You need to create GWT modules:

See this tutorial: GWT Tutorial – Using and creating modules

like image 23
stan229 Avatar answered Sep 23 '22 22:09

stan229