javacaching

Cache java compilation


Is there any posibility to cache java compilation like ccache does for C or C++ compilation?

I have a lot code to compile, and I compile the same code many times, so it took a lot of time. So I thought to cached it to speed up.


But the main problem is that, the whole source code has many files in many directories, and there are so many java files. Compilation is done by the ant scripts which are invoked by the make script. It has to be compiled by the Sun's JDK. And what is more... between compilations I have to clean all created *class files.

So I cannot use any of IDE's features.


Solution

  • Eclipse does incremental compile of classes (I guess others do this as well). Only the portion of your class that changes will be compiled. Everything else will not be changed. It works reasonably well in real world projects.

    Build tools like Maven and Ant can be configured to compile only changed java files. These do not track dependencies in some scenarios they miss needed compiles. (For example change the signature in a super class.)