Gradle hangs then fails if repository is inaccessible

When I’m not on my VPN I can’t access the repository that I’m using for my Gradle artifacts. I expected this to be okay as long as I’d previously downloaded all required dependencies. When I run the test task I’ve seen it hang for 2 minutes and fail like this:

22:11:47.500 [ERROR] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper] :::: ERRORS
22:11:47.500 [ERROR] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper]
Server access Error: Operation timed out url=http://xxxxx:8081/artifactory/repo/com/curiousattemptbunny/gradle-git-version-plugin/0.1/gradle-git-version-plugin-0.1.pom
  22:11:47.501 [ERROR] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper]
Server access Error: Operation timed out url=http://xxxxx:8081/artifactory/repo/com/curiousattemptbunny/gradle-git-version-plugin/0.1/gradle-git-version-plugin-0.1.jar
...snip...
22:11:47.502 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.DefaultIvyDependencyResolver] Timing: Ivy resolve took 2 mins 29.916 secs

This is using the wrapper to access the 1.0-milestone-5 snapshot:

distributionUrl=http://repo.gradle.org/gradle/distributions-snapshots/gradle-1.0-milestone-5-20110913092800+0200-bin.zip

There are quite a few problems with dependency management that mean Gradle (thanks to Ivy) will attempt to look for dependencies that are cached locally when there is no need to.

We are painfully aware of these cases and have deemed it mandatory that this is fixed for the 1.0 release. So there’s no real solution except for keep using the new milestones as we fix more and more cases where this happens.

I’ve marked this as solved, though with versions prior to Gradle 1.0 final you may still see this behaviour, and unforunately there isn’t anything a user can do to remedy this. However, as I have said, we are painfully aware of this problem and it will be resolved for Gradle 1.0.