Section 8.12. Building the Application with Ant


8.12. Building the Application with Ant

Running the XXX-shell and XXX-compile command-line tools may not be the most convenient method for developing a GWT application. What if all you want to do is compile your Java files into JavaScript, copy the altered application to your deploy directory, and refresh the browser to check out the changes? The Ant XML tool allows you to automate this activity. Here is a portion of the Ant file I used to execute GWT's compiler, then copy the results to a directory specified in a properties file.

 <target name="gwt-compile"                description="use gwt's compiler">        <exec executable=               "${module.gwt.basedir}/GwtAjax-compile"             failonerror="true"/>        <copy todir="${web.deploy.location}">             <fileset dir=                   "${module.gwt.basedir}/www/"                   excludes="**/*.cache.xml">           </fileset>       </copy> </target> 

The ${web.deploy.location} syntax is how Ant dereferences property values. For example, web.deploy.location is a property name whose value points to a directory path where the GWT compiler's output will be made available for HTTP requests. This Ant file also excludes copying to the web directory the files ending in .cache.xml (a part of the GWT compiler's output), because these files do not have to be deployed to your web server.




Google Web Toolkit for Ajax
Google Web Toolkit GWT Java AJAX Programming: A step-by-step to Google Web Toolkit for creating Ajax applications fast
ISBN: 1847191002
EAN: 2147483647
Year: 2006
Pages: 29

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net