Fork me on GitHub
NOTICE There is a new plugin (archetypes and eclipse integration), a fresh start that correctly support multi-module projects, it is not version-bounded with GWT, support multiples GWT versions and other fixes, improvements and best practices. This plugin is now considered the legacy GWT maven plugin (aka mojo GWT maven plugin) and the new one is considered the new generation GWT maven plugin (aka tbroyer GWT maven plugin). The legacy maven plugin is still supported but it is strongly encouraged to use the new one for new projects.

Comfortable debugging with GWT, Maven and Eclipse


Needed tools:

  • Eclipse
  • maven
  • m2eclipse plugin
  • Google Plugin for Eclipse

Complex structure of multimodule maven project

The tutorial will use sample structure to describe setup of whole project in Eclipse with possibility to automatically propagate change in source files of dependent modules to final GUI. The sample structure is prepared for extending with new use cases.

Let's consider simplified scenario of one framework module and one customer's web portal.

  • Framework module (fw1-mod) can be used by different portals in combination with different modules
  • Framework module is developed by us and it is reflecting common behaviour used in these portals
  • Customer's portal (cust-war) has also it's own shared module (cust-common) of common customer's behaviour
  • Framework module is more generic, customer shared module is specific only to that customer
  • framework module is located in java/fw1/fw1-mod
  • customer's portal is located in web/cust-portal/cust-war

    This step is common for both alternatives - import projects into Eclipse using m2eclipse facilities.

  • File -> Import -> Maven -> Existing Maven Projects
  • import fw1-mod, fw1-parent, cust-parent and cust-war
  • ensure that Workspace resolution is enabled

Generating Launch configuration

Steps needed to generate one of the launch configurations are as follows:

  • mvn gwt:eclipse
  • there will be a launch configuration generated e.g. sk.seges.mmi.cust.Universe.launch
  • Just search the launch configuration in Eclipse and run it. All dependencies are resolved automatically and the GPE is copying a change transparently. If you take a look on the classpath GPE has it will be the same as the one you would setup for Java App. launch configuration.

You can now do the following:

  • run dev mode with the launcher
  • modify e.g. a string in Location class in fw1-mod
  • press Ctrl+S in Eclipse
  • press Refresh button in your browser
  • voila! change appears