Monday, November 29, 2010

Re: Generating build.xml file for web app

At 02:00 PM 11/29/2010, you wrote:
>... but I don't know how to generate the ant build script ...

i'm a newbie also. if you have the command line versio, create an app
and copy and modify the build.xml (please see below).

i just chabge the app name in about 7 places and it seems to work ok

thanks

<?xml version="1.0" encoding="utf-8" ?>
<project name="Reasy" default="build" basedir=".">
<!-- Arguments to gwtc and devmode targets -->
<property name="gwt.args" value="" />

<!-- Configure path to GWT SDK -->
<property name="gwt.sdk" location="D:/dev/gwt-2.1.0" />

<path id="project.class.path">
<pathelement location="war/WEB-INF/classes"/>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
<!-- Add any additional non-server libs (such as JUnit) -->
<fileset dir="war/WEB-INF/lib" includes="**/*.jar"/>
</path>

<target name="libs" description="Copy libs to WEB-INF/lib">
<mkdir dir="war/WEB-INF/lib" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet-deps.jar" />
<!-- Add any additional server libs that need to be copied -->
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/apache-mime4j-0.6.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/commons-codec-1.4.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/commons-collections-3.2.1.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/commons-io-1.4.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/commons-lang-2.4.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/cssparser-0.9.5.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/htmlunit-2.8.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/htmlunit-core-js-2.8.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/httpclient-4.0.1.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/httpcore-4.0.1.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/httpmime-4.0.1.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/nekohtml-1.9.14.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/sac-1.3.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/serializer-2.7.1.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/xalan-2.7.1.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/xercesImpl-2.9.1.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/dev/htmlunit-2.8/lib/xml-apis-1.3.04.jar" />
<copy todir="war/WEB-INF/lib" file="D:/lib/opencsv-2.2.jar" />
<copy todir="war/WEB-INF/lib" file="D:/lib/comm.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/lib/commons-logging-adapters.jar" />
<copy todir="war/WEB-INF/lib" file="D:/lib/commons-logging-1.1.1.jar" />
<copy todir="war/WEB-INF/lib"
file="D:/lib/commons-logging-adapters-1.1.1.jar" />
<copy todir="war/WEB-INF/lib" file="D:/lib/junit-4.8.2.jar" />
<copy todir="war/WEB-INF/lib" file="D:/lib/log4j-1.2.16.jar" />
<copy todir="war/WEB-INF/lib" file="D:/lib/gwt-log-3.0.3.jar" />
<copy todir="war/WEB-INF/lib" file="D:/lib/RXTXcomm.jar" />
<copy todir="war/WEB-INF/lib" file="D:/lib/rxtxSerial.dll" />
<copy todir="war/WEB-INF/lib" file="D:/lib/rxtxParallel.dll" />
</target>

<target name="javac" depends="libs" description="Compile java
source to bytecode">
<mkdir dir="war/WEB-INF/classes"/>
<javac srcdir="src" includes="**" encoding="utf-8"
destdir="war/WEB-INF/classes"
source="1.5" target="1.5" nowarn="true"
debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path"/>
</javac>
<copy todir="war/WEB-INF/classes">
<fileset dir="src" excludes="**/*.java"/>
</copy>
</target>

<target name="gwtc" depends="javac" description="GWT compile to
JavaScript (production mode)">
<java failonerror="true" fork="true"
classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<arg line="-war"/>
<arg value="war"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="p.Reasy"/>
</java>
</target>

<target name="devmode" depends="javac" description="Run development mode">
<java failonerror="true" fork="true"
classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<arg value="-startupUrl"/>
<arg value="Reasy.html"/>
<arg line="-war"/>
<arg value="war"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="p.Reasy"/>
</java>
</target>

<!--
Test targets suppressed because -junit argument was not specified
when running webAppCreator.

<target name="javac.tests" depends="javac" description="Compiles test code">
<javac srcdir="test" includes="**" encoding="utf-8"
source="1.5" target="1.5" nowarn="true"
destdir="war/WEB-INF/classes"
debug="true" debuglevel="lines,vars,source">
<classpath location="path_to_the_junit_jar"/>
<classpath refid="project.class.path"/>
</javac>
</target>

<target name="test.dev" depends="javac.tests" description="Run
development mode tests">
<mkdir dir="reports/htmlunit.dev" />
<junit fork="yes" printsummary="yes" haltonfailure="yes">
<jvmarg line="-Xmx256m" />
<sysproperty key="gwt.args" value="-standardsMode -logLevel WARN" />
<sysproperty key="java.awt.headless" value="true" />
<classpath>
<pathelement location="src" />
<pathelement location="test" />
<path refid="project.class.path" />
<pathelement location="path_to_the_junit_jar" />
</classpath>
<batchtest todir="reports/htmlunit.dev" >
<fileset dir="test" >
<include name="**/*Test.java" />
</fileset>
</batchtest>
<formatter type="plain" />
<formatter type="xml" />
</junit>
</target>

<target name="test.prod" depends="javac.tests" description="Run
production mode tests">
<mkdir dir="reports/htmlunit.prod" />
<junit fork="yes" printsummary="yes" haltonfailure="yes">
<jvmarg line="-Xmx256m" />
<sysproperty key="gwt.args" value="-prod -standardsMode
-logLevel WARN -standardsMode -out www-test" />
<sysproperty key="java.awt.headless" value="true" />
<classpath>
<pathelement location="src" />
<pathelement location="test" />
<path refid="project.class.path" />
<pathelement location="path_to_the_junit_jar" />
</classpath>
<batchtest todir="reports/htmlunit.prod" >
<fileset dir="test" >
<include name="**/*Test.java" />
</fileset>
</batchtest>
<formatter type="plain" />
<formatter type="xml" />
</junit>
</target>

<target name="test" description="Run development and production mode tests">
<antcall target="test.dev" />
<antcall target="test.prod" />
</target>
-->

<target name="hosted" depends="devmode" description="Run
development mode (NOTE: the 'hosted' target is deprecated)" />

<target name="build" depends="gwtc" description="Build this project" />

<target name="war" depends="build" description="Create a war file">
<zip destfile="Reasy.war" basedir="war"/>
</target>

<target name="clean" description="Cleans this project">
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="war/Reasy" failonerror="false" />
</target>

</project>

---
co-chair http://ocjug.org/

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment