Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Compilation with Maven is slow #862
At every file change, Maven does recompile the whole 1337 source files, which takes a while, makes my laptop take off and swap
Is there a way to improve this?
Or maybe there is a fast path for compiling a new extension, aside from the global build and running tests with requir'ing the extension dynamically?
Sigh. So I spent a couple hours trying to solve this...playing with compiler flags, trying different compiler plugins (two based on Eclipse's JDT and one based on Scala's SBT), reading articles about how javac doesn't actually do incremental compilation and "ant" just fakes it. Nothing worked.
Until I read the code associated with maven-compiler-plugin's "useIncrementalCompilation" flag. The logic here seems reversed; Incremental compilation appeared to always forcibly recompiling everything if any source changes. The false path, incremental compilation turned off, gathered a list of recently-modified source files and only compiled those.
So, on a hunch, I set useIncrementalCompilation to false. Bingo...incremental builds. If I touch a file now, only that files is rebuilt.
There's a chance this will not be acceptable. It probably won't recompile dependent files, resulting in them failing at runtime (when we move on from editing to testing and debugging). But I don't think that's any different from e.g. ant's "incremental" logic, and if we're using IDEs to refactor, ideally all statically-referencing dependencies should get updated together.
We'll run with this for a while and see how it goes.
Fixed in 37ce7da