Java 瓦丁小部件编译
我有Vaadin 6.8.6应用程序,并使用ant构建它。现在我也想使用ant重新编译我的应用程序,但编译器并没有看到我在应用程序中实现的小部件。所以我有这样的ant构建脚本。在我的项目中,我有一些软件包Java 瓦丁小部件编译,java,gwt,vaadin,Java,Gwt,Vaadin,我有Vaadin 6.8.6应用程序,并使用ant构建它。现在我也想使用ant重新编译我的应用程序,但编译器并没有看到我在应用程序中实现的小部件。所以我有这样的ant构建脚本。在我的项目中,我有一些软件包 com.example.vaadinresearch ..ServerComponent...class --com.example.vaadinresearch.widgetset ..MyApp.class ..MyApp.gwt.xml ---com.example.v
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>
com.example.vaadinsearch
…服务器组件…类
--com.example.vaadinresearch.widgetset
…MyApp.class
…MyApp.gwt.xml
---com.example.vaadinresearch.widgetset.client
VClientComponent.class
正在更新${widgetset}。。。
记住在web.xml中定义widgetset,如下所示。
初始化参数
参数名称WidgetSet/参数名称
参数值${widgetset}/param值
/初始化参数
正在将${widgetset}编译到${client-side destination}目录中。。。
在web.xml文件中,您必须添加
<init-param>
<param-name>widgetset</param-name>
<param-value>you.widgetset.package</param-value>
</init-param>
widgetset
you.widgetset.package
在应用程序servlet中。您可能还必须具有包含以下内容的widgetset.gwt.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="you.widgetset.package" />
</module>
谢谢!但问题是在GWT编译之前我没有编译类。因此,除了其他JAR中的类之外,它找不到任何类。我的错(谢谢你把你是怎么解决的,而不是“哦,我已经找到问题了”。讨厌别人那样做。