Is incremental compilation broken for Groovy?


(Jesper Skov) #1

Compiling my Groovy projects have always taken a long time. I sort of assumed it was due to (and happily blamed) the virus checker.

But it looks like it is due to Groovy compilation not being incremental.

If I change one or two files, all 112 .groovy-files in the project ends up being compiled again.

Is this intentional (as in, too hard to determine cross-references in Groovy, so recompile all to be safe), or is something broken in Gradle (or my setup)?

I’m using Gradle 1.6

Thanks, Jesper


(Luke Daley) #2

Groovy and Java compilation is never incremental in Gradle. There are no existing (safe) incremental compilers for these languages.

The incremental compilation used by Ant (and Maven) is inaccurate and problematic in practice, therefore Gradle does not use it.


(Jesper Skov) #3

I don’t remember having had problems with Ant, but maybe I’m not pushing the envelope, or I just resolved to clean re-builds and have forgotten about it.

Sounds like a very interesting problem to solve though.

Presumably, Eclipse and other IDEs can do incremental compilation because they have a live model of the inter-class dependencies?!

Do you have references to specific/known flaws in Ant/Maven? Sounds like a fun winter project :slight_smile:


(Attila Kelemen) #4

You can still use the Ant compiler as they do in OpenJFX (Ant compiler is used if a particular property says so). This means, that you have to accept the flaws. See the relevant post of Richard Bair: http://forums.gradle.org/gradle/topics/faster_incremental_builds.

@Luke: Do you have some info on JEP-139? When (or if) we can expect incremental compilation.


(Peter Niederwieser) #5

Based on what I read on the openjdk-compiler-dev list, JEP-139 appears to be an internal feature that won’t ship with Oracle JDK 8.

As for incremental Groovy (rather than Java) compilation, the best chance to get that in Ant/Maven/Gradle is to use the standalone Groovy-Eclipse compiler. Gradle doesn’t currently have out-of-the-box support for that compiler, so you’d have to integrate it on your own. (G)Maven does support it, but I don’t know if they support incremental compilation.


(Attila Kelemen) #6

Thanks for the info. There seems to be some hope for the future given this comment: “evaluate how it should integrated into the full product”. It is a little optimistic though considering Jigsaw was promised for Java 7. Maybe if they were moving to Gradle … :slight_smile:


(Luke Daley) #7

For anyone following along at home, Facebook’s Buck build system advertises smart incremental Java compile.