Why does ant compile all classes each run?

后端 未结 3 916
刺人心
刺人心 2021-02-20 12:30

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

相关标签:
3条回答
  • 2021-02-20 12:50

    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">

    0 讨论(0)
  • 2021-02-20 12:55

    In my experience the javac target will not compile all the classes, only the ones in need of it, even without the includeDestClasses attribute. In fact I usually set up two (or more) compile targets, one that does a complete compile (forced by deleting the output directory) and one that does a quick updating compile, much like your javac line. Are you sure that one of your dependencies isn't deleting the output directory?

    0 讨论(0)
  • 2021-02-20 12:56

    Your src & dest directories are not equivalent, so ant is not able to effectively stat the output files to compare them.

    This is an FAQ: http://ant.apache.org/faq.html#always-recompiles

    0 讨论(0)
提交回复
热议问题