使用GWT项目依赖项编译GWT项目

时间:2012-03-12 00:21:28

标签: java eclipse gwt ant compilation

我想用蚂蚁脚本询问我的问题。我有两个GWT项目,一个依赖于另一个。我正在尝试使用ant脚本编译它们,但由于:

我失败了
 [java]       [ERROR] Errors in 'file:/$PATH/$CLASS_NAME.java'
 [java]          [ERROR] Line 29: No source code is available for type $INHERITED_INTERFACE; did you forget to inherit a required module?

虽然$ INERITED_INTERFACE来自编译项目所依赖的库,而$ CLASS_NAME是实现该接口的类。

我尝试过这么简单,但它不起作用:

<target name="gwtcomp" depends="javacomp" description="GWT to JS">
    <echo message="Building GWT" />

    <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
        <classpath>
            <pathelement location="${basedir}/src" />
            <path refid="project.class.path" />
        </classpath>
        <jvmarg value="-Xmx512M" />
        <arg value="-strict" />

        <arg value="${project.dep.gwt.config}" />
        <arg value="${project.gwt.config}" />
    </java>
</target>

但它无法通过错误。我还继承了GWT库:

<module rename-to='project'>
    ...
    <inherits name='my.lib.common.Common'/>
</module>

不确定是什么问题。 Common.gwt.xml就在那里,它指向客户端并作为源包共享。任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

我猜你必须在你的ant脚本中将my.lib.common.Common库的源位置添加到类路径中。 像这样:

<classpath>
    <pathelement location="${basedir}/src" />
    <path refid="project.class.path" />
    <pathelement location="LOCATION_TO_MY.LIB.COMMON.COMMON"/>
</classpath>