I was just curious to know this, when i give mvn install without doing \'clean\', maven compiles only the modified java files. How does maven identify a java file is modifie
Robert Scholte's comment at https://issues.apache.org/jira/browse/MCOMPILER-205 explains the process. It depends on the "useIncrementalCompilation" option of the "maven-compiler-plugin" (and on the version of it btw, I've only managed to have "useIncrementalCompilation" work with 3.1, not 3.0):
I see there's some confusion, so something needs to be changed, maybe improving documentation is good enough. Looking at the code, you'll see that non-incremental will only look at changed sourcefiles. Incremental will also verifies if dependencies have changed and if files have been added or removed. If it has changed, it'll remove the complete classes-directory. The reason is that the default java compiler is quite fast, likely much faster than analyzing per file what to do with it. IIUC the eclipse compiler is a real incremental compiler, so we could decide that based that based on the used compiler not to drop the classes directory.