GWT Warning “Non-canonical source package”

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:




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:





The following dependency would have to be added to MyModule.gwt.xml:

<inherits name=’client.ClientModule’></inherits>


GWT Google Group – Source-Source


2 thoughts on “GWT Warning “Non-canonical source package”

    1. ClientModule.gwt.xml can just be a default module definition such as:

      <module rename-to="ClientModule">
      <inherits name="" />
      <entry-point class="client.DummyEntryPoint" />

      (please note you might need to add inherits as well)

      Hope this helps.

Leave a Reply to dsms Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s