私がここで聞いたことを言い換えて、私のような怠惰な人々のためにそれを言い換えます:
antのjavacタスクを使用してインクリメンタルビルドを実現できますが、dependタスクを使用して、変更した.javaの.classファイルをクリアする必要があります。また、javacタスクでincludesステートメントを指定しないままにしないでください。(javacタスクでsrcパスのみを指定し、インクルードを指定しないままにすると、javacは検出したすべてのソースを再コンパイルします。)
これが私の依存タスクとjavacタスクです。標準のOracleJavaコンパイラでは、変更した.javaファイルのみがコンパイルされます。お役に立てれば!
<depend srcdir="JavaSource" destdir="${target.classes}" cache="${dependencies.dir}" closure="yes">
<classpath refid="compiler.classpath" />
<include name="**/*.java"/>
</depend>
<javac destdir="${target.classes}" debug="true" debuglevel="${debug.features}" optimize="${optimize.flag}" fork="yes" deprecation="no" source="1.6" target="1.6" encoding="UTF-8" includeantruntime="no">
<classpath refid="compiler.classpath"/>
<src path="JavaSource"/>
<include name="**/*.java" /> <!-- This enables the incremental build -->
</javac>