views:

58

answers:

2

Hi all, how can I prevent Ant to process 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.

Thanks

+1  A: 

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.

Aaron Digulla
+2  A: 

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.

abyx