Solution/ANT

[Ant] Ant build Sample

FreeEnd 2008. 7. 24. 10:16
반응형
<project name="SampleProject" default="compile" basedir=".">
 
 <description>
  Sample build file for Tomcat server.
 </description>
 
 <!-- set global properties for this build -->
 <property name="dist"  location="dist"/>
 <property name="build" location="classes"/>
 <property name="src" location="src"/>
 <property name="CATALINA_HOME" value="c:tomcat 5.0" />
 <property name="debug" value="on"/>
 <property name="debuglevel" value=""/>
 <property name="optimize" value="off"/>
 <property name="deprecation" value="on"/>
 <property name="verbose" value="no" />
 <property name="failonerror" value="true" />
 <property name="listfiles" value="true" />
 <property name="compress" value="9" />
 
 <path id="project.classpath">
  <fileset dir="${CATALINA_HOME}/common/lib">
   <include name="**/*.jar"/>
  </fileset>
  <fileset dir="${CATALINA_HOME}/server/lib">
   <include name="**/*.jar"/>
  </fileset>
  <fileset dir="lib">
   <include name="**/*.jar"/>
  </fileset>
 </path>
 
 <target name="init">
  <!-- Create the time stamp -->
  <tstamp/>
  <!-- Create the build directory structure used by compile -->
  <mkdir dir="${build}"/>
 </target>
 
 <target name="compile" depends="init" description="Compile the source " >
  <!-- Compile the java code from ${src} into ${build} -->
  <javac
   srcdir="${src}"
   destdir="${build}"
   classpathref="project.classpath"
   debug="${debug}"
   debuglevel="${debuglevel}"
   optimize="${optimize}"
   deprecation="${deprecation}"
   verbose="${verbose}"
   failonerror="${failonerror}"
  />
 </target>
 
 <target name="dist" depends="compile" description="Generate the distribution" >
  <!-- Create the distribution directory -->
  <mkdir dir="${dist}"/>
  <!-- Put everything in ${build} into the PROJECT_NAME-${DSTAMP}.jar file -->
  <jar destfile="${dist}/${ant.project.name}-${DSTAMP}.jar" basedir="${build}"/>
 </target>
 
 <target name="archive" depends="compile" description="Archive all files" >
  <!-- Create the distribution directory -->
  <mkdir dir="${dist}"/>
  <!-- Put everything in ${build} into the HoneyProject-${DSTAMP}.jar file -->
  <zip
   destfile="${dist}/${ant.project.name}-${DSTAMP}.zip"
   basedir="../"
   compress="${compress}"
  />
 </target>
 
 <target name="clean" description="Clean up" >
  <!-- Delete the ${build} and ${dist} directory trees -->
  <delete dir="${build}"/>
  <delete dir="${dist}"/>
 </target>
 
</project>

[출처] Ant build sample file|작성자 민구리

반응형