Prevent Ant from performing a task if a file is older than another file
how can I pre开发者_StackOverflow中文版vent Ant from processing a task if a source file is older than the current target. For example, I created a javacc file MyParser.jj
and there is no need for javacc to re-generate the file MyParser.java as long as the MyParser.jj
is older than MyParser.java
.
As Aaron said, the javacc
task shouldn't be executed on code that hasn't changed.
But, to answer to original question - there's an uptodate
task that can be used for this purpose. Here's an example.
There must be a bug elsewhere or your version of Ant is too old. From the docs:
This task only invokes JavaCC if the grammar file is newer than the generated Java files.
精彩评论