Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

'ant' build file for HelloWorldServlet and JettyLauncher (See related posts)

A pretty straightforward 'ant' build file. You will need to edit the jetty.home property to indicate where you installed Jetty.

   1  
   2  <?xml version="1.0" encoding="UTF-8"?>
   3  <project basedir="." default="compile" name="hello-servlet">
   4    <property name="build.dir"	location="classes" />
   5    <property name="src.dir"	location="src/main/java" />
   6    <property name="jetty.home"	location="/home/mrw/projects/jetty-6.1.3" />
   7    <property name="jetty.lib"	location="${jetty.home}/lib" />
   8  
   9    <path id="jetty.lib.path">
  10      <pathelement path="${jetty.lib}/jetty-6.1.3.jar" />
  11      <pathelement path="${jetty.lib}/jetty-util-6.1.3.jar" />
  12      <pathelement path="${jetty.lib}/servlet-api-2.5-6.1.3.jar" />
  13    </path>
  14  
  15    <target name="compile" description="Compile the project">
  16      <mkdir dir="${build.dir}" />
  17      <javac debug="true" destdir="${build.dir}" srcdir="${src.dir}"
  18  	classpathref="jetty.lib.path">
  19        <compilerarg value="-Xlint:unchecked" />
  20        <compilerarg value="-Xlint:deprecation" />
  21      </javac>
  22    </target>
  23  
  24    <target name="all"  depends="clean,compile"
  25        description="Recompile from scratch"/>
  26  
  27    <target name="server" depends="compile" description="Launch the server">
  28      <java classname="com.babblemind.JettyLauncher" fork="true"
  29  	classpathref="jetty.lib.path">
  30        <classpath>
  31  	<pathelement path="${build.dir}" />
  32        </classpath>
  33      </java>
  34    </target>
  35  
  36    <target name="clean" description="Delete all files created by compile">
  37      <delete dir="${build.dir}" />
  38      <delete dir="docs/api" />
  39    </target>
  40  </project>

You need to create an account or log in to post comments to this site.


Click here to browse all 5355 code snippets

Related Posts