I solve this problem with maven. The common code is packaged as a separate maven project and then used as a library. Here are the snippets from the pom.xml file:
<dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <version>2.0.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-dev</artifactId> <version>2.0.4</version> <scope>provided</scope> </dependency> <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/client/**/*.java</include> <include>**/client/**/*.properties</include> <include>**/shared/**/*.java</include> <include>**/shared/**/*.properties</include> <include>**/*.gwt.xml</include> </includes> </resource> </resource> </build>
The above build configuration copies the additional source files needed by the GWT compiler to the last jar.
If you use eclipse as an IDE, the m2eclipse plugin can be used to automatically process all dependencies. It is possible that all projects open in one workspace and the classpath of a common project will be shared. The only drawback is the requirement to call project > clean from time to time (it will force the built-in maven to copy all the resources specified in the above snippet).
source share