IntelliJ recompiles a lot of files on a minor changes

Sometimes when I slightly change a source file in a Grails project and run a test related to this source, plenty of sources are recompiled. They seem not related to the modified source.

Is this a known behaviour (intended or bug)? If it's not intended, how can I see WHAT triggers the compilation of other sources?

Cheers,

Marcin

5 comments

Groovy compiler doesn't support incrementality very well, so in some cases (involving cyclic class dependencies) IDEA
has to recompile the whole module. A sample project demonstrating the issue could help us to determine if this is the case.

0

I encounter this issue in my current customer project. Therefore I'm not allowed to hand out its source code as it is. Maybe with obfuscation it would be feasible. Do you know such a tool for Groovy code?

0

No, I don't know of any such tools. We can still understand something by turning on some logging.

Do you use external build (Settings | Compiler)? Does this recompilation happen often? Does it happen on nonsensical changes, like space insertion? Could you please start with isolating a specific change (as small as possible) that causes large recompilation?

0

We can still understand something by turning on some logging.

Can you give me some guidance about how to turn it on? Is it possible to find a reason why file X.groovy is recompiled? (i.e. is there an output from the compiler that says: 'compiling X.groovy because Y.groovy has changed')

Do you use external build (Settings | Compiler)?

Yes.

Does this recompilation happen often? Does it happen on nonsensical changes, like space insertion?

It can happen every couple of minutes. It happens usually when I'm working on a production class/unit test. Even when I change the class and unit test only, every now and then all the project is recompliled.

Could you please start with isolating a specific change (as small as possible) that causes large recompilation?

I'll try (and engage my co-workers). However, I tried to spot a pattern in the compiler behaviour, but by now I'm totally clueless.

0

Thanks for the answers. It will become clear which logging to enable after we have some scenario reproducible in a reliable way. Anyway, please attach your log (Help | Show log), maybe it already contains something interesting.

Is the whole project recompiled, or just the whole module production or tests (including its cyclic dependencies, if any)?

0

Please sign in to leave a comment.