Ce contenu n'est pas disponible dans la langue sélectionnée.

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 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.
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat