IntelliJ IDEA takes a long time to upgrade Gradle project

I have a very large project, with many subprojects configured in Gradle. When I make a clean build from the command line, it takes about 10 minutes, but after that the creation of the whole project is very fast.

My problem is to import the project into IntelliJ Community Edition. When importing for the first time, it takes about 10 minutes, but after that, whenever I make an update in a project, it still takes the same amount of time. I see that the background job is running: I see that the messages are displayed very quickly, and then they are stored in Gradle: Build , and I have no idea what it does!

I tried to increase the log level and I see a DEBUG message saying: .project.GradleProjectResolver - Gradle data obtained in 311943 ms , which, in my opinion, is a reason that takes a lot of time, but, as I said, I have no idea what he does which needs this amount of time

By the way, I'm using a gradle shell (not sure if that matters)

Any help is appreciated, thanks in advance

+8
intellij-idea gradle gradlew
source share
1 answer

I had a similar problem with Gradle 3.4.1 and IDEA 2016.3.5. Updating a significant project took about 30 minutes. I hooked up YourKit profiler to the Gradle daemon to find out what it does. I noticed that he spent a lot of time at java.net.Inet6AddressImpl.lookupAllHostAddr . When I looked for this problem, I quickly found this solution: http://justthesam.com/2016/10/fixing-java-net-inet6addressimpl-lookupallhostaddr-slowdown/

The problem seems to be related to Java processes on Mac OSX on a network that does not support IPv6, which results in IPv6 search timeouts. To apply this hotfix, enter hostname in the terminal window to find your hostname. Then add the hostname to /etc/hosts .

 127.0.0.1 localhost Your-Hostname-Here ::1 localhost Your-Hostname-Here 

Leave localhost there to make sure you don't break anything. Kudos to Sam for finding this fix.

Please note that you may experience lengthy updates for various reasons. But connecting a Gradle daemon profiler should give you more information about what is going on.

+7
source share

All Articles