「Java入門」ant使い方メモ
build.xml:
<project name="olympics" default="run">
<property name="lib_path" value="lib"/>
<property name="jar_name" value="cs3051.jar"/>
<property name="jar_opencsv" value="opencsv-2.3.jar"/>
<property name="dest_dir" value="build/classes"/>
<property name="src_dir" value="src"/>
<property name="man_class" value="cs5031.cw1.olympics.OlympicsMedalTable"/>
<!– retrieve the OpenCSV library and put it into the lib_path –>
<target name="retrieve">
<mkdir dir="${lib_path}"/>
<get src="http://repo1.maven.org/maven2/net/sf/opencsv/opencsv/2.3/opencsv-2.3.jar" dest="${lib_path}"/>
</target>
<target name="init">
<mkdir dir="${dest_dir}"/>
</target>
<target name="compile" depends="init" >
<javac srcdir="${src_dir}" destdir="${dest_dir}" classpath="${lib_path}/${jar_opencsv}"/>
</target>
<target name="build" depends="compile">
<jar jarfile="${jar_name}" basedir="${dest_dir}"/>
</target>
<target name="run" depends="build">
<java classname="${man_class}" classpath="${jar_name}:${lib_path}/${jar_opencsv};."/>
</target>
</project>