我一直在使用GWT很长一段时间,现在只使用eclipse插件来编译我的项目。由于新的要求,我需要使用ant build(第一次)来构建gwt项目。首先我会说我有两个模块,它们有一个入口点,另外两个模块只包含java类(它们应该被翻译成js),并且它们位于我工作区中的不同项目中。使用蚂蚁编译gwt项目的问题
目前我有GWT项目需要反过来需要DAL项目的公共项目(当我要求我的意思是它在eclipse项目构建路径中定义时)。在我的GWT项目中,我在适当的位置有一个Common.gwt.xml和DAL.gwt.xml文件,它们将这些文件定义为模块,并且我的ModuleEntryPoint.gwt.xml继承了这两个模块(除了其他模块)。当我目前使用gwt eclipse插件编译一切正常。
但是,当我试图用ant构建这个模拟时,我的ModuleEntryPoint的编译失败,因为编译器说它无法找到属于DAL模块或Common模块的类的源。
蚂蚁构建代码是非常基本的,因为这是我的第一次尝试。
在此先感谢您获得的任何帮助。
<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}"/>
<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>
非常感谢,但我想我发现了这个问题。在'compile-gwt'任务中,我没有给他通用模块来源(../Common/src等)的路径,所以我已经添加了它,它的工作原理。谢谢。 – Ittai 2010-02-11 07:30:13