Since a few weeks, my gradle build has gotten significantly slower, especially during the initialization phase. This takes about 3:30 minutes where this used to be around 30 seconds. Stopping the daemon and removing the caches does not solve this problem. Unfortunately, I now have a build setup performance problem to prevents me from doing my job. Any help would be appreciated!
You can use the Gradle profiler to see where the time is being spent. Note that 30s is already way too slow, not even speaking of 3:30. Initialization should be <1s for most projects.
Unfortunately, the 30 seconds is standard in our multiproject setup. All the other developers also have this slow configuration and initialization time. I think this is due to how our multiproject is set up, this is something we will tackle at a later time. For now, the sudden increase in configuration/initialization time is the main focus. I have tried the gradle-profiler, but this somehow gives a big stacktrace as it is not Gradle 5.0 compatible yet. Is there a way to use the 4.10 version?
Not sure what you mean by not compatible, it should work just fine for 5.0. If it doesn’t, please provide the stacktrace.
gradle-profiler --profile jfr --warmups 5 --iterations 5 help
I managed to get the gradle-profiler to work. I had to use the --gradle-version=4.10 parameter. I’m not sure what to make of the benchmark results.
If you have to use that parameter, your project isn’t using the Gradle wrapper, which you should definitely do to ensure reproducible builds.
Please send me the JFR recording, I can have a look.
Hi Stefan,
I have found the problem. Due to an error in OSX High Sierra, the org.gradle.java plugin was the culprit. Modifying the /etc/hosts file with the hostname of my laptop fixed the problem, solution was found here: https://thoeni.io/post/macos-sierra-java/
I will keep parameter thing in mind when I need to use the gradle-profiler in the future.
Thanks for the quick replies,
Robert Voorn