How do I develop a non-UI client-side GWT library?
Question
I wish to write a shared library to be used in various GWT applications. The shared library will leverage GWT APIs and should not be able to use non-emulated Java classes.
Two questions:
- Is there a plugin for Eclipse that will let me use GWT APIs and flag if I use a non-emulated class (but will simply build a compliant jar rather than a war)? (I know that the standard plugin does this when working in the 'client' area, I just want the same behaviour for the entire source tree)
- If not, is there a Maven/Ant plugin that will help?
Solution
For a GWT library, you have to include a GWT module (*.gwt.xml
file) and the *.java
files in your *.jar
(or in a distinct JAR if you prefer).
AFAIK, the Google Plugin for Eclipse uses the information from the *.gwt.xml
files, the client
subpackage is not hard-coded; so you should be able to use it the same way as with a GWT application.
Finally, you can call the GWT compiler with the argument -validateOnly
to check that your GWT module uses only translatable classes.
OTHER TIPS
I am pretty sure that you can't develop a gwt shared library and pack it into a jar file. Gwt require access to all source code when compiling files. It can't read class files at all. Or have I misunderstood what you are trying to do?