所以我正在使用 ant,我让它编译和运行正常,但我想让它在完成输出后删除所有 .class 文件。我以为我的做法是正确的,但显然我不是。
这是我的代码:
<project default="run">
<description>
Compile/run all the files
</description>
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<target name="prob1" depends='compile'>
<java classname='prob1'>
<classpath path='./' />
<arg value='Gertrude' />
</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='2001' />
</java>
</target>
<target name="prob4" depends='compile'>
<java classname='prob4'>
<classpath path='./' />
<arg value='3' />
</java>
</target>
<target name="compile">
<javac srcdir='./' />
</target>
<target name="clean">
<delete>
<fileset dir="." includes="*.class"/>
</delete>
</target>
</project>