我试图在GWT框架中使用:http://code.google.com/p/jspf/。我知道GWT需要包含类的来源。我已将jspf的代码放在我的{SRC_DIR}中,而我的build.xml包含此条目:
<path id="project.class.path">
<pathelement location="${basedir}/src" />
<fileset dir="${war_lib_dir}" includes="**/*.jar" />
<pathelement location="${javac_precompile_classes_dir}" />
</path>
但是当我运行ant任务时,它失败了:
[echo] Starting GWTC
[java] Compiling module com.x.y.z
[java] Validating newly compiled units
[java] [ERROR] Errors in 'file:/u/v/XyzClass.java'
[java] [ERROR] Line 201: No source code is available for type net.xeoh.plugins.base.util.JSPFProperties; did you forget to inherit a required module?
[java] [ERROR] Line 203: No source code is available for type net.xeoh.plugins.base.PluginManager; did you forget to inherit a required module?
[java] [ERROR] Line 208: No source code is available for type net.xeoh.plugins.base.impl.PluginManagerFactory; did you forget to inherit a required module?
[java] [ERROR] Line 209: No source code is available for type net.xeoh.plugins.base.util.uri.ClassURI; did you forget to inherit a required module?
[java] [ERROR] Line 211: No source code is available for type com.netapp.sysmgr.plugin.SysmgrPlugin; did you forget to inherit a required module?
[java] Finding entry point classes
build.xml的片段
<target name="javac" depends="libs" description="Compile server java source and any other required files">
<echo>Compiling server source</echo>
<mkdir dir="${war_classes_dir}" />
<javac srcdir="${basedir}/src" includes="**/server/**/*.java" encoding="utf-8" destdir="${war_classes_dir}"
source="1.5" target="1.5" nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath>
<path refid="project.class.path" />
</classpath>
</javac>
<echo>Pre-compiling vendor specific source</echo>
<mkdir dir="${javac_precompile_classes_dir}" />
<javac srcdir="${basedir}/src" includes="**/vendor/**/*.java" encoding="utf-8" destdir="${javac_precompile_classes_dir}"
source="1.5" target="1.5" nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path" />
</javac>
答案 0 :(得分:1)
GWT需要源代码,因为它将它编译为JavaScript。这些错误是因为您在应用程序的客户端使用了未在模块文件(.gwt.xml文件)中组织的源代码,或者您没有继承模块文件。这是错误引用的内容:did you forget to inherit a required module
。只是添加源代码不会帮助GWT找到源代码,也必须有一个模块文件。
为了能够使用这些源,必须存在模块文件,或者您必须自己创建并在模块文件中继承它。以下是有关模块的文档:http://code.google.com/intl/nl-NL/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuideModules虽然文档对于如何为这种情况创建自己的模块文件有些简要。