Consider the following project setup
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-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.
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:
<profile>
<id>dev</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>../api/src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-sources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>../api/src/main/resources</directory>
<targetPath>resources</targetPath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
You can then test in development mode and edit files in multible projects by running:
In Netbeans it is possible to save such a run target in the user interface.