Absolutely. It's easy and quick.
here's one of mine you may find useful to crib from. So long as your
happy to use the build directory under your project directory (i.e.
next to \src), and your OK with setting GWT_HOME as an environment
variable (you can replace that with full paths to the GWT jars if you
want) you can probably just copy this into your project directory and
edit build.properties with your details - it should work (but check
the fileset in the classpath and lib in the war task for any other
jars your app needs - I always put all mine under "lib" as you can
see).
build.properties:
deploy=C:/jboss-4.0.4/server/default/deploy
module=IPSV
package=com.willow.gwt.ipsv
url=
http://localhost:8080/${ant.project.name}/${package}.${module}/$
{module}.html
war=${
ant.project.name}.war
build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="IPSV" default="deploy" basedir=".">
<property environment="env"/>
<property file="build.properties"/>
<path id="classpath">
<pathelement location="build"/>
<pathelement location="src"/>
<pathelement location="${env.GWT_HOME}/gwt-user.jar"/>
<pathelement location="${env.GWT_HOME}/gwt-dev-windows.jar"/>
<pathelement location="${env.GWT_HOME}/gwt-servlet.jar"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="clean"
description="deletes all generated files">
<delete dir=".gwt-cache"/> <!-- generated by GWT -->
<delete dir="build"/> <!-- generated by the prepare target -->
</target>
<target name="compile" depends="prepare"
description="compiles Java source files to bytecode">
<javac srcdir="src" destdir="build"
classpathref="classpath" debug="true">
</javac>
</target>
<target name="compile.gwt" depends="compile"
description="compiles Java source files to JavaScript">
<!-- Consider adding -Xms256m -Xmx512m to improve performance. -->
<java classname="com.google.gwt.dev.GWTCompiler"
classpathref="classpath" fork="true">
<!--<arg line="-logLevel INFO"/>
<arg line="-gen build/review"/> -->
<arg line="-out build/www"/>
<!-- <arg line="-treeLogger"/> -->
<arg line="-style OBFUSCATE"/>
<!--<arg value="${module}"/> -->
<arg value="${package}.${module}"/>
</java>
</target>
<target name="deploy" depends="war"
description="deploys the war file to Tomcat">
<copy file="build/${war}" todir="${deploy}"/>
<echo>browse ${url}</echo>
</target>
<target name="prepare" description="creates output directories">
<mkdir dir="build"/>
</target>
<target name="war" depends="compile, compile.gwt"
description="builds the war file">
<delete file="build/${war}"/>
<war warfile="build/${war}" webxml="WEB-INF/web.xml">
<!-- bytecode from your Java code -->
<classes dir="build" includes="**/*.class"/>
<!-- generated HTML/JavaScript plus your CSS -->
<fileset dir="build/www"/>
<!-- supplied JAR -->
<lib file="${env.GWT_HOME}/gwt-servlet.jar"/>
<lib dir="lib">
<include name="**/*.jar"/>
</lib>
</war>
</target>
</project>
regards
gregor
On Feb 7, 10:08 pm, ssylvis <
ssyl...@gmail.com> wrote:
> You can use Ant to create your webapp WAR then deploy it to Tomcat. No
> restarts necessary.
>
> To create your WAR file, use the "war" task. You will have to use the
> "java" task to hook into the GWTCompiler and compile your Java to
> JavaScript/HTML before generating the WAR. Something like this:
>
> <java classname="com.google.gwt.dev.GWTCompiler" dir="${bld.web}"
> fork="true">
> <arg value="-style" />
> <arg value="DETAILED" />
> <arg value="${
webapp.full.name}" />
> <classpath>
> <path refid="path.main.all" />
> <path refid="path.gwt.res" />
> </classpath>
> </java>
> <!-- Construct the war file from the GWT-compiled files. -->
> <war destfile="${bld.web}/${
deploy.name}.war" webxml="$
> {webapp.package.path}/deploy/web.xml">
> <fileset dir="${bld.web}/${
webapp.full.name}" />
> <classes dir="${obj.main}" includes="**/*.class" />
> <lib dir="${lib}" includes="*.jar, *.so" />
> </war>
>
> See here:
http://ant.apache.org/manual/CoreTasks/war.html.
>
> To deploy, see here:
http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Executing%....