<?xml version="1.0" encoding="UTF-8"?>
<project name="Calculator" basedir="." default="run">
<property name="src.dir" value="./src"/>
<property name="build.dir" value="./classes"/>
<property name="classes.dir" value="./classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="client-class" value="com.test.calc.Client"/>
<property name="server-class" value="com.test.calc.Server"/>
<property name="junit" value="lib/junit-4.12.jar"/>
<property name="lib.dir" value="${basedir}/lib"/>
<path id="classpath">
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile" depends="clean">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false">
</javac>
<mkdir dir="${classes.dir}/lib"/>
<copy todir="${classes.dir}/lib">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
</target>
<target name="build" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/Client.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${client-class}"/>
</manifest>
</jar>
<jar destfile="${jar.dir}/Server.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${server-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="build">
<parallel>
<java jar="${jar.dir}/Server.jar" fork="true" classpath="classpath">
</java>
<!--<waitfor maxwait="5" maxwaitunit="second" timeoutproperty="failtimeout">-->
<!--<socket server="localhost" port="8189"/>-->
<!--</waitfor>-->
<java jar="${jar.dir}/Client.jar" fork="true" classpath="classpath">
</java>
</parallel>
</target>
<target name="test" depends="compile">
<junit printsummary="on" fork="true" showoutput="true">
<classpath>
<pathelement location="${classes.dir}"/>
<pathelement location="lib/junit-4.12.jar"/>
<pathelement location="lib/hamcrest-core-1.3.jar"/>
<pathelement location="lib/MathParser.org-mXparser-4.1.1.jar"/>
</classpath>
<formatter type="brief" usefile="false"/>
<test name="test_class.CalculatorTest"/>
</junit>
</target>
</project>
<property name="classes.dir" location="./classes"/>
<target name="test" depends="build">
...
</target>