I think I've a similar situation which I managed to solve without duplicating code.
I've a large number of classes representing various database tables in a server app. These classes are used by a variety of applications--some command line, some JSP, some GWT, etc. The developement directory is organize like so
javadev/
database/
build.xml
src/
com/
/corp
/database
*.java
lib/
server/
servlet-utils/
utils/
project-a/
project-b/
project-gwt/
lib/
database-gwt/
build.xml
src/
com/
corp/
client/
MyDb.java
MyDatabase.gwt.xml
MyDb.gwt.xml
war/
...
client-app/
build.xml
src/
war/
The javadev/database directory builds a JAR file used by the server and different projects. All classes implement java.io.Serializable and use only GWT serializable data types (Date, not Calendar).
The javadev/project-gwt/database-gwt builds a JAR file with both *.class and *.java files.
The MyDatabase.gwt.xml looks like
<module>
<inherits name="com.google.gwt.core.Core"/>
<source path="database"/>
</module>
The MyDb.gwt.xml looks like
<module rename-to='mydb'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.corp.MyDatabase' />
<entry-point class='com.corp.client.MyDb'/>
</module>
The MyDb.java is nothing more than an entry point to serve as a target for compiling the module:
package com.corp.client;
import com.google.gwt.core.client.EntryPoint;
public class MyDb implements EntryPoint {
public void onModuleLoad() {
// no op
}
}
After that, it's matter of arranging ant targets (through depends attributes) such that javadev/project-gwt/database-gwt/build.xml calls javadev/database/build.xml, then calling targets for javac, gwtc, and jar. The jar target collects the *.java, *.class, and *.gwt.xml files:
<target name="jar" depends="javac"
description="Package up the project as a jar">
<jar destfile="mydb-gwt.jar">
<fileset dir="war/WEB-INF/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="src">
<include name="**"/>
</fileset>
<fileset dir="../../database/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="../../database/src">
<include name="**"/>
</fileset>
</jar>
</target>
Now project-gwt's *.gwt.xml file includes <inherits name='com.corp.MyDatabase' /> and all is good.
I hope this helps.