Fork me on GitHub

Productivity tip for multi-project setup


Consider the following project setup

  • api (jar) - GWT library
  • gui (war) - GWT gui with endpoint that uses the library.

    With this layout, any change to the api (gwt library) must be repackaged as a JAR and the hosted mode must be restarted to see the change in the hosted browser.

    The following tip explains how to use the build-helper-maven-plugin to improve productivity and hack the multi-project wall between modules.

Build helper

Build-helper-maven-plugin allow you to setup additional source folders for your project. The idea here is to declare the api source folder to make it "visible" from the war project / hosted mode browser.

If you add a source path with the build-helper-maven-plugin directly in the gui's pom you will possibly have problems because of 2 issues.

  • At least my IDE (Netbeans) cannot have two open projects that share the same source path. The api module will loose its src/java in the user interface, and the gui will get one ekstra "generated sources" path, this is quite annoying.
  • Because there is no guarantee on how the developer will checkout the code, the gui's pom cannot guess where the api's src/main/java is on the disk.


The solution to those two issues is to create a profile in your pom which you'd only activate when you run the gwt:run target:


You can then test in development mode and edit files in multible projects by running:

mvn gwt:run -Pdev

In Netbeans it is possible to save such a run target in the user interface.