更新时间:2023-10-01 14:52:40
ant手册对于Javac 说:
如果您只希望编译明确指定的文件并禁用 javac的默认搜索机制,则可以取消设置sourcepath 属性:
If you wish to compile only files explicitly specified and disable javac's default searching mechanism then you can unset the sourcepath attribute:
<javac sourcepath="" srcdir="${src}"
destdir="${build}" >
<include name="**/*.java"/>
<exclude name="**/Example.java"/>
</javac>
不过,我认为这不是一个好主意.在设计良好的项目中,应编译给定目录(或一组目录)中的所有文件.不应该编译的文件根本不应该存在,或者应该位于单独的目录中.
I don't think it's a good idea, though. In a well-designed project, all the files in a given directory (or in a set of directories) should be compiled. The files which shouldn't be compiled shouldn't be there at all, or should be in a separate directory.