我在maven的帮助下解决了这个问题。通用代码打包为单独的maven项目,然后用作库。下面是从pom.xml文件摘录:由GWT编译器需要到最终的jar
<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>
上面构建配置额外的复制源文件。
在使用eclipse作为IDE的情况下,m2eclipse插件可用于自动处理所有依赖关系。可以共享单个工作区中打开的所有项目以及公共项目的类路径。唯一的缺点是需要不时调用project > clean
(将强制嵌入式maven复制上面代码段中指定的所有资源)。
我期待着尽快尝试。谢谢。 – 2010-09-06 20:18:38
这只是解决方案的一半,因为当项目A被添加到项目B的构建路径中时,项目B将只能看到A的编译类,而不是'.java'文件,并且GWT编译器需要'.java '文件。因此,您必须将Java文件作为“资源”添加到A的输出中。如果A是Maven项目,则可以这样做,正如morisil在上面显示的那样。 – ddekany 2014-03-16 12:49:51