GWT: building war with Maven 2 and Ant and deploying to Tomcat - single click

<project name="csd" default="prep_deploy" basedir=".">


<property name="WAR_EXPLODED" value=".\\target\\csd" />

<echo>

ATTENTION! CREATE FOLLOWING FILE IF MISSING:

.\\src\\main\\resources\\${user.name}.properties 

echo>

<property file=".\\src\\main\\resources\\${user.name}.properties" />


<target name="clean">

<delete dir="com.ucc.csd.CSD" />

<delete dir="www" />

<delete dir="target" />

<delete dir="bin" />

<delete dir="target-eclipse" />

<delete dir="tomcat" />

<echo>Refresh your Eclipse project (F5)echo>

target>


<target name="war" depends="clean">

<echo>Maven Executable: ${MAVEN_EXEC}echo>

<exec taskname="mvn war" dir="${basedir}" executable="${MAVEN_EXEC}">

<arg line="clean compile war:war -Dtarget=${TARGET}" />

exec>

<delete file=".\\target\\csd.war" />

target>


<target name="hibernate_hbm_to_ddl" depends="clean">

<echo>Maven Executable: ${MAVEN_EXEC}echo>

<exec taskname="mvn hbm2ddl" dir="${basedir}" executable="${MAVEN_EXEC}">

<arg line="clean compile hibernate3:hbm2ddl -Dtarget=${TARGET}" />

exec>

<delete file=".\\target\\csd.war" />

target>


<target name="prep_test" depends="war">

<copy file=".\\target\\classes\\applicationContext.xml" tofile=".\\src\\main\\resources\\applicationContext_test.xml" />

target>


<target name="test" depends="prep_test">

<echo>Maven Executable: ${MAVEN_EXEC}echo>

<exec taskname="mvn test" dir="${basedir}" executable="${MAVEN_EXEC}">

<arg line="test -Dtarget=${TARGET}" />

exec>

target>


<target name="gwt_shell" depends="war">

<echo>GWT: starting hosted (dev)echo>

<java taskname="GWT hosted" classpathref="class_path" classname="com.google.gwt.dev.GWTShell" fork="true" maxmemory="256m">

<jvmarg line="-verbose ${JVM_ARG_START}" />

<arg line="-out www com.ucc.csd.CSD/CSD.html" />

java>

target>


<target name="gwt_compile_to_js" depends="war">

<java taskname="GWT compile" classpathref="class_path" classname="com.google.gwt.dev.GWTCompiler" fork="true" maxmemory="512m">

<jvmarg line="-verbose ${JVM_ARG_START}" />

<arg line="-logLevel WARN -out www com.ucc.csd.CSD" />

java>

target>


<target name="prep_deploy" depends="gwt_compile_to_js">

<copy todir="${WAR_EXPLODED}">

<fileset dir="www/com.ucc.csd.CSD" />

copy>

<copy file=".\\src\\com\\ucc\\csd\\CSD.gwt.xml" todir="${WAR_EXPLODED}\\WEB-INF\\classes\\com\\ucc\\csd" />

target>


<target name="deploy_locally" depends="prep_deploy">

<echo>DID YOU STOP TOMCAT?echo>

<delete dir="${DEPLOY_DIR}" />

<copy todir="${DEPLOY_DIR}">

<fileset dir="${WAR_EXPLODED}" />

copy>

<echo>START YOUR TOMCATecho>

target>


<path id="class_path">

<pathelement path=".\\src" />

<pathelement path=".\\src\\main\\java" />

<pathelement path=".\\target\\classes\\" />

<fileset dir="${GWT_HOME}">

<include name="*.jar" />

fileset>

<fileset dir="${WAR_EXPLODED}\\WEB-INF\\lib">

<include name="*.jar" />

fileset>

path>


project>

No comments:

Post a Comment