Path with pathelement : Path Dir « Ant « Java

Path with pathelement

<?xml version="1.0"?>

<project name="yourName" default="junitgui" basedir=".">
  <property name="junitJar" value="\junit3.8.1\junit.jar" />
  <property name="src.dir" value="${basedir}\src" />
  <property name="build.dir" value="${basedir}\classes" />

  <path id="classpath">
    <pathelement location="${junitJar}" />
    <pathelement location="${build.dir}" />

  <target name="init">
    <mkdir dir="${build.dir}" />

  <target name="build" depends="init" description="build all">
        srcdir="${src.dir}" destdir="${build.dir}"
        deprecation="on" debug="on" optimize="off" includes="**">
      <classpath refid="classpath" />

  <target name="junitgui" depends="build" description="run junitgui">
    <java classname="junit.awtui.TestRunner" fork="yes">
      <arg value="sis.AllTests" />
      <classpath refid="classpath" />

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

   <target name="rebuildAll" depends="clean,build" description="rebuild all"/>


Related examples in the same category

1.Specify basedir
2.File separator
3.Path separator
4.Build path unix
5.Get current location
6.Path convert
7.Ant path
8.Define path with file set
9.Ant task: make dir
10.Convert path format from one os to another