I am writing a build file for its basic run, clean and compile properties. Here is what I have:
<?xml version="1.0" encoding="ISO-8859-1"?>
<project default="compile">
<description>
Compile and run the Java files for Lab7
</description>
<target name="prob1" depends='compile'>
<java classname='prob1'>
<classpath path='./'/>
<arg value='Gertrude'/>
<arg value='Justin'/>
</java>
</target>
<target name="prob2" depends='compile'>
<java classname='prob2'>
<classpath path='./'/>
<arg value='28'/>
</java>
</target>
<target name="prob3" depends='compile'>
<java classname='prob3'>
<classpath path='./'/>
<arg value='2000'/>
</java>
</target>
<target name="prob4" depends='compile'>
<java classname='prob4'>
<classpath path='./'/>
<arg value='2'/>
</java>
</target>
<target name="compile">
<javac srcdir='./' includeantruntime="false"/>
</target>
<target name="clean">
<delete>
<fileset dir="./">
<include name='*.class'/>
</fileset>
</delete>
</target>
</project>
I am trying to run each prob with different arguments one at a time. Like in prob1 i want to run it with the first name then again with the second name, how do I do this?
Yes something like that is possible using antlib, which offers a wide range of functionalities like for loops, if conditions and macros. You can define a macro like
and then you can call it like this
You can read about antlib in the manual