Skip to content

Instantly share code, notes, and snippets.

@shwangdev
Created August 16, 2011 10:52
Show Gist options
  • Save shwangdev/1148843 to your computer and use it in GitHub Desktop.
Save shwangdev/1148843 to your computer and use it in GitHub Desktop.
ant build sample
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE project>
<project name="income" default="usage" basedir=".">
<property name="project-name" value="income"/>
<property name="build" value="build"/>
<property name="lib" value="/usr/share/java/"/>
<property name="src" value="income/"/>
<property name="build.classes" value="${build}/classes" />
<property file="build.properties"/>
<property name="jar.dir" value="${build}/jar"/>
<property name="jar-file-name" value="${project-name}" />
<path id="Third-Part Lib">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="prepare" >
<mkdir dir="${build.classes}" />
<mkdir dir="${jar.dir}" />
</target>
<target name="clean" >
<delete dir="${build}" />
<delete dir="${jar.dir}" />
</target>
<target name="compile" depends="clean,prepare">
<echo message="Compiling the source code!"/>
<javac
srcdir="${src}"
destdir="${build.classes}"
deprecation="true"
failonerror="true" debug="true"
>
<classpath refid="Third-Part Lib"/>
</javac>
</target>
<target name="jar" depends="compile">
<jar destfile="build/jar/IncomeCalculator.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="income.IncomeCalculator"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java jar="build/jar/IncomeCalculator.jar" fork="true"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment