ANT 任务包含 GWT 的源文件
我正在尝试使用:http://code.google.com/p/jspf/在 GWT 框架内。我知道 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>
I am trying to use : http://code.google.com/p/jspf/ within a GWT framework. I know that GWT needs source of the included classes. I have placed the code for jspf in my {SRC_DIR} and my build.xml contains this entry:
<path id="project.class.path">
<pathelement location="${basedir}/src" />
<fileset dir="${war_lib_dir}" includes="**/*.jar" />
<pathelement location="${javac_precompile_classes_dir}" />
</path>
But when I run the ant task, it fails with :
[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
Snippet from 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GWT 需要源代码,因为它将其编译为 JavaScript。这些错误是因为您在应用程序的客户端中使用了未在模块文件(.gwt.xml 文件)中组织的源代码,或者您没有继承该模块文件。这就是错误所指的内容:
您是否忘记继承所需的模块
。仅添加源并不能帮助 GWT 找到源,还必须有一个模块文件。为了能够使用这些源,必须存在一个模块文件,或者您必须自己创建并在模块文件中继承它。以下是有关模块的文档:http:// code.google.com/intl/nl-NL/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuideModules 虽然文档是简要介绍如何针对这种情况创建自己的模块文件。
GWT needs the sources because it compiles it to JavaScript. The errors are because you have used source code in the client side of your application that isn't organized in a module file (.gwt.xml file) or you didn't inherit the module file. This is what the error refers to:
did you forget to inherit a required module
. Just adding the sources will not help GWT to find the sources, there must be a module file too.To be able to use those sources there must be a module file present or you must create on yourself and inherit it in your module file. Here is the documentation on modules: http://code.google.com/intl/nl-NL/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuideModules Although the documentation is somewhat brief on how to create your own module file for this situation.