Google Web Toolkit (Beta)
Search this site:

# Module XML Format

Modules are defined in XML files whose file extension is `.gwt.xml`. Module XML files should reside in your project's root package.

If you are using the standard project structure, your module XML can be as simple as this:

     <module>
        <inherits name="com.google.gwt.user.User"/>
        <entry-point class="com.example.cal.client.CalendarApp"/>
     </module>

## Loading Modules

Module XML files are found on the Java classpath, referenced by their logical module names from host pages and by being inherited by other modules.

Modules are always referred to by their logical names. The logical name of a module is of the form `pkg1.pkg2.ModuleName` (although any number of packages may be present) and includes neither the actual file system path nor the file extension. For example, the logical name of a module XML file located at

    ~/src/com/example/cal/Calendar.gwt.xml

is

    com.example.cal.Calendar

## Available Elements

<inherits name="logical-module-name"/>
  Inherits all the settings from the specified module as if the contents of the inherited module's XML were copied verbatim. Any number of modules can be inherited in this manner.
<entry-point class="classname"/>
  Specifies an entry point class. Any number of entry-point classes can be added, including those from inherited modules.
<source path="path"/>
  Adds packages to the source path by combining the package in which the module XML is found with the specified path to a subpackage. Any Java source file appearing in this subpackage or any of its subpackages is assumed to be translatable.

  If no `<source>` element is defined in a module XML file, the `client` subpackage is implicitly added to the source path as if `<source path="client">` had been found in the XML. This default helps keep module XML compact for standard project layouts.

<public path="path"/>
  Adds packages to the public path by combining the package in which the module XML is found with the specified path to identify the root of a public path entry. Any file appearing in this package or any of its subpackages will be treated as a publicly-accessible resource. The `<public>` element supports pattern-based filtering to allow fine-grained control over which resources get copied into the output directory during a GWT compile.

  If no `<public>` element is defined in a module XML file, the `public` subpackage is implicitly added to the public path as if `<public path="public">` had been found in the XML. This default helps keep module XML compact for standard project layouts.

<servlet path="url-path" class="classname"/>
  For convenient RPC testing, this element loads a servlet class mounted at the specified URL path. The URL path should be absolute and have the form of a directory (for example, `/spellcheck`). Your client code then specifies this URL mapping in a call to ServiceDefTarget.setServiceEntryPoint(String). Any number of servlets may be loaded in this manner, including those from inherited modules.
<script src="js-url"/>
  Automatically injects the external JavaScript file located at the location specified by src. See automatic resource inclusion for details.
<stylesheet src="css-url"/>
  Automatically injects the external CSS file located at the location specified by src. See automatic resource inclusion for details.
<extend-property name="client-property-name" values="comma-separated-values"/>
  Extends the set of values for an existing client property. Any number of values may be added in this manner, and client property values accumulate through inherited modules. You will likely only find this useful for specifying locales in internationalization.