Compilation with Maven is slow #862

eregon opened this Issue Jul 8, 2013 · 5 comments


None yet

3 participants

eregon commented Jul 8, 2013


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?

With ant, it sometimes was necessary to ant clean but compilation was much faster (yet the longest task was creating the .jar).

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?


if I take an older version of the maven-compiler-plugin 2.5.1 then it just recompiles the changed files as I would expect it from incremental compilation. BUT I do not get the bootclasspath for jruby configured :(

hope there is a solution . . .


3f93c50 should get a nice incremental compilation with maven. hope that keeps your laptop away from using the swap ;)

@mkristian mkristian closed this Jul 8, 2013
@mkristian mkristian reopened this Jul 8, 2013

does not work :(

headius commented Jul 9, 2013

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

@headius headius closed this Jul 9, 2013
eregon commented Jul 9, 2013

Seems to work at me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment