Slow java compilation with JDK 11 and gradle 6.8+ on MacOS

Has anyone encountered extreme compilation times on JDK 11.0.2 MacOs with gradle 6.8? If I use JDK14 it seems normal, but I need to use JDK11 LTS.

Could it be due to annotation processors and plugins I’m using? (QueryDSL, Lombok, Spring dependency management).

–profile just tells me its all in compile…

Is there a clue in the fact that JDK14 works properly?


Yes, I ran into a JDK bug and had to skip 11. It was more pronounced due to ErrorProne. Maybe you are observing a similar problem.

I haven’t been able to identify what the problem is - gradle 5.5.1 on jdk 11.0.2 takes 1 min 30 seconds, whereas gradle 6.8.2 on jdk 11.0.2 takes 4 mins.

So I cannot upgrade to gradle 6, it’s just not worth the hit.

From what I’ve observed, it is all due to one module (in a multi module project), all attributed to compiling, and after commenting out all plugins and comparing a clean compile of this one module:

gradle 5.5.1 → 22s
gradle 6.8.2 → 2 mins

I’ve tried removing all plugins so I don’t think its a plugin problem.
I do have 2 annotation processors though: lombok, querydsl - but again, I don’t think its them.
Running gradle with --profile shows all the time is spent in compileJava.

Yet switching to JDK14 the compile completes in 20s…

So, I’m still no closer to explaining why gradle 5.5.1 is okay, but gradle 6.8 isn’t…

If anyone has any suggestions, I’d love to hear them.


Per the issue linked above, you might be impacted by JDK-8209055. This is not caused by annotation processors or plugins, but a memory leak in the compiler itself. The jira indicates the fix was backported, so you might ensure you have the latest JDK11 build.

Note: You are on 11.0.2 which is listed as affected. Try the latest build.

Oh wow, thank you! That did it.

I updated jdk11 (

brew install adoptopenjdk11
jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/
jenv local

And now my compile time is back to normal with gradle 6.8.2!
Thank you!