为什么 ant 每次运行都要编译所有类? [英] Why does ant compile all classes each run?
问题描述
我更习惯于make,所以我很困惑为什么ant在源代码没有改变的情况下重新编译类.我读到在某些使用泛型的情况下需要重新编译,但我不确定这对我的项目是否必要.
I'm more accustomed to make, so I'm confused why ant recompiles classes when the source hasn't been changed. I've read that there is a requirement to recompile in some cases where generics are used, but I'm not sure that this will be necessary for my project.
此外,在 javac 任务中,我设置了 includeDestClasses="true"
Also, in the javac task, I've set includeDestClasses="true"
这是我正在使用的一些目标
Here's some of the targets I'm using
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${dist}"/>
</target>
<target name="compile" depends="init,util,semantics" description=""/>
<target name="util" depends="" description="">
<javac destdir="${build}" classpath="project.class.path" debug="on" srcdir="${src}/util" includeDestClasses="true" source="1.5">
<classpath refid="project.class.path"/>
</javac>
</target>
推荐答案
尝试修改 javac
任务的开始标记以包含 srcdir
属性和 >includes
属性:
Try modifying the opening tag of the javac
task to include both a srcdir
attribute and an includes
attribute:
<代码><javac destdir="${build}" classpath="project.class.path" debug="on" srcdir="${src}" includes="util/**" includeDestClasses="true" source="1.5>
这篇关于为什么 ant 每次运行都要编译所有类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!