此内容没有您所选择的语言版本。

25.4. GWT Ant Targets


To deploy GWT applications, you must also perform compilation to JavaScript. This compacts and obfuscates the code. You can use an Ant utility instead of the command line or GUI utility provided by GWT. To do so, you must have GWT downloaded, and the Ant task JAR in your Ant classpath.
Place the following near the top of your Ant file:
<taskdef uri="antlib:de.samaflost.gwttasks" 
         resource="de/samaflost/gwttasks/antlib.xml" 
         classpath="./lib/gwttasks.jar"/> 
<property file="build.properties"/>
Copy to Clipboard Toggle word wrap
Create a build.properties file containing:
gwt.home=/gwt_home_dir
Copy to Clipboard Toggle word wrap
This must point to the directory in which GWT is installed. Next, create a target:
<!-- the following are handy utilities for doing GWT development.
     To use GWT, you will of course need to download GWT seperately -->
     
<target name="gwt-compile">
  <!-- in this case, we are "re homing" the gwt generated stuff, so 
       in this case we can only have one GWT module - we are doing this 
       deliberately to keep the URL short -->
  <delete>
    <fileset dir="view"/>
  </delete>
  <gwt:compile outDir="build/gwt"
               gwtHome="${gwt.home}"
               classBase="${gwt.module.name}"
               sourceclasspath="src"/>
    <copy todir="view">
      <fileset dir="build/gwt/${gwt.module.name}"/>
    </copy>
</target>
Copy to Clipboard Toggle word wrap
When called, this target compiles the GWT application and copies it to the specified directory (likely in the webapp section of your WAR).

Note

Never edit the code generated by gwt-compile — if you need to edit, do so in the GWT source directory.
We highly recommend using the hosted mode browser included in the GWT if you plan to develop applications with the GWT.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat