Gradle Version: 3.0+ (tested with the lastest nightly, 3.3-20161023000015)
Operating System and JVM version: Ubuntu 12.04+, Oracle JDK8
Is this a regression? If yes, which version of Gradle do you know it last worked for? no
I discovered that the build is very slow for my project. I created a minimal example, which can reproduce the issue.
The project contains a single Dummy Java class, without any code (this is required for reproducing the error). By swapping the order of repositories, the build becomes much slower: the build time on Travis increases from ~2 minutes to ~10 minutes: https://travis-ci.org/szarnyasg/gradle-slow-build/builds
The build stops at the compileJava / compileClasspath goal for minutes. The problem occurs on my local machine as well, even if the dependencies were resolved earlier and are available in the local Gradle cache.
eclipse.org has been having a lot of technical difficulties lately, so I’m not surprised you saw slow builds when using their repositories. It’s back down to 15s for me. Still not fast, but better than several minutes. I suggest using their repositories last.
Thanks for your answer. I still have issues building my larger projects so I did some experiments and made the following observation: the build is slow on the first try, but if I run the build with with --offline switch, it finishes very quickly and with success (as it already has the required dependencies).
Can I enforce Gradle to try the local cache first (even in online mode), instead of trying to connect to the servers? This should work for my project – there are no snapshot dependencies that should be checked every time the build runs.
All exited successfully, with 0 exit value. Is there a way that could speed up subsequent builds (without --offline), even if there is an unavailable (but unused) repository?
Gradle will cache the result it gets from a repository, if it finds a particular module, or if it finds that the module is missing. The issue is that Gradle doesn’t cache any result for a repository when we fail to connect, if authentication fails, or if the repository returns a bad status.
With this build, Gradle will attempt to connect to http://www.systap.com/maven/releases on every execution, and this connection times out after about 1 minute. You can see this happening in the debug logs: https://gist.github.com/bigdaz/a27932aa5d74f5ca75468d4e2b461a0a.
To fix this, we’d need to record this “broken” or “timeout” status in our dependency cache, so that we wouldn’t attempt to connect on every build invocation. Naturally, this cache record should expire periodically, in case the broken status of the repository is transient.
Thank you for the detailed explanation. Fortunately, the artifacts that I used from the Systap repository are now available in the Maven Central (related ticket), so I can remove the repository from the build.