The Problem
Sometimes you might want to include classes from a package in your gwt module, which are not in a sub-package of the package in which you have defined the Gwt module (MyModule.gwt.xml).
For instance, you might have the following directory structure:
/client/ClientService.java
/browser/BrowserEntryPoint.java
/browser/MyModule.gwt.xml
The first natural option would be to define a source dependency in the Gwt module (gwt.xml) as follows:
<source path=’../client’ />
However, when compiling the module, a “Non-canonical source package” warning is issued. Furthermore, the class in the client package will not be recognized by the Gwt compiler.
The Solution
One clean (but not necessary straightforward) solution is to define a new Gwt module in the client package, and link this in your original module. The directory structure would change to:
/client/ClientService.java
/client/ClientModule.gwt.xml
/browser/BrowserEntryPoint.java
/browser/MyModule.gwt.xml
The following dependency would have to be added to MyModule.gwt.xml:
<inherits name=’client.ClientModule’></inherits>
Resources
GWT Google Group – Source-Source
and how does the ClientModule.gwt.xml looks like?
ClientModule.gwt.xml can just be a default module definition such as:
<module rename-to="ClientModule">
<inherits name="com.google.gwt.user.User" />
<entry-point class="client.DummyEntryPoint" />
</module>
(please note you might need to add inherits as well)
Hope this helps.