Gradle 5.0-rc1 problem with artifact resolution in Intellij import

With Gradle 5.0-rc1 I experience very long import times when using the gradle-intellij-plugin.

Profiling revealed that the problem is the method ErrorHandlingModuleComponentRepository.tryResolveAndMaybeBlacklist that explicitly calls Thread.sleep repeatedly before blacklisting the internal repository. This adds around 50 seconds to the Gradle import in my case. There was no such problem with Gradle 4.10.2. How can I further debug this situation?

My current workaround is to call

System.setProperty("org.gradle.internal.repository.initial.backoff", "1")

which reduces the sleep times to a couple of ms.

@ingokegel is this something that happens on every import or just the first import?

Also see https://github.com/gradle/gradle/issues/7787

What you are experiencing is most likely a consequence of the change implemented for https://github.com/gradle/gradle/issues/4629

So anything you can investigate / report on the networking setup is interesting to us.

This happens on every import, not only the first one. There is no error, the import completes successfully. I’m importing a multi-module project with a single nexus repository and the problem is only caused by the project that uses the plugin that I mentioned above. If I remove that project from the build, the import is fast.

And, most interestingly, I only get this problem on my macOS machine, but not on my Windows machine. Like in https://github.com/gradle/gradle/issues/7787 the conditions seem to be quite sensitive.

When profiling, I did not see that any HTTP requests were made for the dependency resolutions that lead to these blacklistings.

I would like to see which dependency resolutions actually cause the problem. How do I switch on the loggers to get some some debugging output?

Thanks for the added information. We need to improve the debuggability of http retries so that such issues can be analyzed better. Even turning on debug log level will not be enough here.

Assuming your project cannot be shared, would you be ok to try out a custom Gradle version so that we can understand the issue better?

If yes:

  • Checkout the Gradle release branch from https://github.com/gradle/gradle

  • Apply the attached patch, extracting it from the attached zip file: patch.zip (1.1 KB)

  • Build a binary distribution with ./gradlew binZip

  • Configure your project’s wrapper to point to that file, found in <gradle_root>/build/distributions

  • Import your project

  • Report here the exceptions that follow the lines starting with Error while accessing remote repository

You are still welcome in trying the above to diagnose the solution, but Gradle 5.0 RC5 will provide an easier way.

  • It will no longer catch errors, which means it might break your build if the underlying cause was an unrecoverable error.
  • If it does not, the logging statement will include the exception if you turn on debug level.

How do I set the logging level for the Gradle import in IDEA? I would presumably need a VM parameter that I pass via the “Gradle VM options” setting.

I tried to pass -Dorg.gradle.logging.level=debug to the Gradle VM options in the IDEA configuration, but that does not affect the import. I looked at the source code of the IDEA Gradle plugin and it always passes --info as an argument for the project resolver unless --debug is already contained in the arguments. I don’t see any way to pass arguments for the import, only VM parameters. I have to see the debug output for the import and not for the command line build, because this only happens during the import. Am I missing something?

@ljacomet FYI, I don’t have this problem anymore with the current master branch, probably it was fixed by

I would still be interested in how to change the logging level for the Gradle project import, though.