Simple Ant Script

I finished creating a prototype for one module of the current project I am involved in. It involved EJB and Struts and all I can say is that everything was worthwhile. Anyway, I'm trying out more examples on EJB online to further enhance my knowledge. It's been quite a pain following the examples using the commandline so I decided to use Ant. I don't memorize all the Ant tags, I still look them up on the internet. Here, I have created one for the example I am following.

[code language="XML"]

 <?xml version="1.1" ?>

<project name="SimpleSessionApp" default="build">

  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist" location="dist"/>

  <property name="JBOSS.CLIENT" location="C:\jboss-4.2.2.GA\client"/>
  <property name="JBOSS.LIB" location="C:\jboss-4.2.2.GA\lib"/>


  <path id="compile.classpath">
    <fileset dir="${JBOSS.CLIENT}">
      <include name="*.jar"/>
    </fileset>
    <fileset dir="${JBOSS.CLIENT}">
      <include name="*.jar"/>
    </fileset>
  </path>


  <target name="clean">
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>

  <target name="prepare" depends="clean">
    <mkdir dir="${build}"/>
    <mkdir dir="${dist}"/>
  </target>
 
  <target name="compile" depends="prepare">
    <javac srcdir="${src}" destdir="${build}">
      <classpath refid="compile.classpath"/>
    </javac>
  </target>
 
  <target name="build" depends="compile">
  </target>

  <target name="deploy" depends="build">
    <jar jarfile="${dist}/${ant.project.name}.jar" basedir="${build}">
    </jar>
    <move file="${dist}/${ant.project.name}.jar" tofile="${dist}/${ant.project.name}.ejb3"/>
  </target>

</project>

[/code]

 

Published 12-14-2007 4:25 AM by lamia
Filed under: