用ant编译gwt项目的问题

Itt*_*tai 5 compiler-construction ant gwt

我已经使用GWT很长一段时间了,到目前为止只使用eclipse插件来编译我的项目.由于新的要求,我需要使用ant构建(第一次)来构建gwt项目.首先我要说我有2个模块有一个入口点和2个其他常见模块,它们只包含java类(应该转换为js),它们位于我工作区的不同项目中.

目前我有GWT项目需要Common项目,而该项目又需要DAL项目(当我说要求时,我的意思是它在eclipse项目构建路径中如此定义).在我的GWT项目中,我在适当的位置有一个Common.gwt.xml和DAL.gwt.xml文件,它们将这些文件定义为模块,我的ModuleEntryPoint.gwt.xml继承了这两个模块(除了其他模块).当我目前使用gwt eclipse插件编译一切运行良好.

但是,当我尝试使用ant构建模拟这个时,我的ModuleEntryPoint的编译失败,因为编译器说它无法找到属于DAL模块或Common模块的类的源.

ant构建代码非常基础,因为这是我的第一次尝试.
提前感谢您提供的任何帮助.

    <path id="compile.classpath">
    <fileset dir="${build.dir.WEB-INF.lib}">
                <include name="**/*.jar" />
                <include name="**/*.xml" />
    </fileset>
    <fileset dir="${ExternalLib.WebServer.dir}">
            <include name="**/*.jar" />
            <include name="**/*.xml" />
    </fileset>

    <fileset dir="${GWT.dir}">
            <include name="**/*.jar" />
            <include name="**/*.dll" />
    </fileset>

</path>

<target name="clear_previous_war">
<delete dir="${build.dir}" />
<mkdir dir="${build.dir.WEB-INF.classes}"/>
<mkdir dir="${build.dir.WEB-INF.lib}"/>
Run Code Online (Sandbox Code Playgroud)

<target name="build_common" >
    <jar destfile="${build.dir.WEB-INF.lib}/${jar.common}"
        basedir="${common.dir.build}"
        includes="com/**"
        excludes="**/.svn"
      />    
</target>

<target name="build_dal" >
    <jar destfile="${build.dir.WEB-INF.lib}/${jar.dal}"
        basedir="${dal.dir.build}"
        includes="com/**"
        excludes="**/.svn"
      />    
</target>

<target name="copy_additional_files" >
    ... Copies all required external jars to web-inf/lib
</target>

<target name="compile_web_classes" >
    <javac srcdir="src" classpathref="compile.classpath"
    destdir="${build.dir.WEB-INF.classes}"
            source="1.6"/>  
</target>

<target name="compile_gwt_button"  description="GWT compile to JavaScript">
                <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
                        <classpath>
                                <pathelement location="${src.dir}" />
                                <path refid="compile.classpath" />                  
                        </classpath>
                        <jvmarg value="-Xmx256M" />
                        <arg value="com.myCompany.web.Button" />
                </java>
 </target>

<target name="deploy" description="Build web project">
    <antcall target="clear_previous_war" />
    <antcall target="build_common" />
    <antcall target="build_dal" />
    <antcall target="copy_additional_files" />
    <antcall target="compile_web_classes" />
    <antcall target="compile_gwt_button" />
</target>
Run Code Online (Sandbox Code Playgroud)

Itt*_*tai 4

compile-gwt任务中,我没有给他公共模块源的路径(../Common/src 等),所以我添加了它并且它可以工作。就像是:

<classpath>
    <pathelement location="src"/>
    <pathelement location="../Common/src"/>
    <path refid="gwt.compile.classpath"/>
  </classpath>
Run Code Online (Sandbox Code Playgroud)