我有 Vaadin 6.8.6 应用程序并使用 ant 构建它。现在我也想使用 ant 重新编译我的应用程序,但编译器看不到我在我的应用程序中实现的小部件。所以我有这样的蚂蚁构建脚本。在我的项目中,我有包
com.example.vaadinresearch
..ServerComponent...class
--com.example.vaadinresearch.widgetset
..MyApp.class
..MyApp.gwt.xml
---com.example.vaadinresearch.widgetset.client
VClientComponent.class
<project name="com.example.vaadinresearch" basedir="." default="all">
<target name="all" depends="clean, init,compile, widgetset-init, generate-widgetset, compile-widgetset, compile, war-package">
</target>
<target name="clean">
<delete dir="build" />
<delete dir="WebContent/VAADIN" />
<delete dir="WebContent/WEB-INF/classes/" />
<mkdir dir="WebContent/WEB-INF/classes/" />
</target>
<target name="init" depends="clean">
<echo message="Creating two packages:" />
<echo message="1. WAR package that can be deployed to application server or servlet container." />
<echo message="2. JAR package which requires JRE only, includes embedded web server." />
<property name="server.main.class" value="com.vaadin.demo.DesktopServer" />
<property name="webserver.jar" value="WebServer/winstone-0.9.9.jar" />
<property file="build.properties" />
<mkdir dir="build" />
</target>
<target name="widgetset-init" depends="init">
<!-- Folders -->
<property name="src.dir" value="src" />
<property name="lib.dir" value="WebContent/WEB-INF/lib" />
<property name="build.web.dir" value="build" />
<property name="widgetset" value="com.example.vaadinresearch.widgetset.VaadinresearchWidgetset" />
<property name="client-side-destination" value="WebContent/VAADIN/widgetsets" />
</target>
<!-- Generates a combined widget set from all widget -->
<!-- sets in the class path, including project sources. -->
<!-- Updates the configuration if it already exists. -->
<target name="generate-widgetset" depends="widgetset-init" if="generate.widgetset">
<echo>Updating ${widgetset}...</echo>
<echo>Remember to define the widgetset in web.xml as follows.</echo>
<echo>
<init-param>
<param-name>widgetset</param-name>
<param-value>${widgetset}</param-value>
</init-param>
</echo>
<java classname="com.vaadin.terminal.gwt.widgetsetutils.WidgetSetBuilder" failonerror="yes" fork="yes" maxmemory="512m">
<arg value="${widgetset}" />
<jvmarg value="-Xss1024k" />
<jvmarg value="-Djava.awt.headless=true" />
<classpath>
<pathelement path="${src.dir}" />
<pathelement location="${lib.dir}/gwt-user.jar" />
<pathelement location="${lib.dir}/gwt-dev.jar" />
<pathelement location="${lib.dir}/vaadin-6.8.6.jar" />
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<!-- Compiles the widget set using the GWT compiler. -->
<target name="compile-widgetset" depends="widgetset-init, generate-widgetset">
<echo>Compiling ${widgetset} into ${client-side-destination} directory...</echo>
<java classname="com.google.gwt.dev.Compiler" failonerror="yes" fork="yes" maxmemory="1000m">
<arg value="-draftCompile" />
<arg value="-localWorkers" />
<arg value="2" />
<arg value="-style" />
<arg value="PRETTY" />
<arg value="-war" />
<arg value="${client-side-destination}" />
<arg value="${widgetset}" />
<jvmarg value="-Xss1024k" />
<jvmarg value="-Djava.awt.headless=true" />
<classpath>
<pathelement location="${lib.dir}/gwt-user.jar" />
<pathelement location="${lib.dir}/vaadin-6.8.6.jar" />
<pathelement location="${lib.dir}/gwt-dev.jar" />
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<pathelement path="${src.dir}"/>
<pathelement path="${build.web.dir}/WEB-INF/classes" />
</classpath>
</java>
</target>
<target name="compile" depends="compile-widgetset">
<echo message="Compiling Vaadin application sources." />
<path id="com.example.vaadinresearch">
<fileset dir="WebContent">
<include name="WEB-INF/lib/*.jar" />
</fileset>
</path>
<javac srcdir="src" destdir="WebContent/WEB-INF/classes" classpathref="com.example.vaadinresearch">
</javac>
</target>
<!-- Creates Vaadin WAR package (requires Application Server / Servlet Container) -->
<target name="war-package" depends="compile">
<echo message="Creating WAR package." />
<war warfile="build/${ant.project.name}.war" webxml="WebContent/WEB-INF/web.xml">
<fileset dir="WebContent">
<include name="**/*" />
<exclude name="WEB-INF/web.xml" />
</fileset>
</war>
</target>
</project>