开发者

ANT task to include source files for GWT

开发者 https://www.devze.com 2023-03-25 13:02 出处:网络
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 conta

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,var开发者_如何学运维s,source">
    <classpath refid="project.class.path" />
</javac>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号