Gradle – A Build Issue when using gradle

gradle

I'm trying to build a opensource Java project, lilith, with gradle. But meet this problem when runing gradle from cmd line window:

D:\Opensource\lilith_svn\sulky-master>gradle

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'sulky-master'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve org.apache.maven.wagon:wagon-webdav-jackrabbit:1.0-beta-6
.
     Required by:
         :sulky-master:unspecified
      > Could not GET 'http://repo1.maven.org/maven2/org/apache/maven/wagon/wagon-webdav-jackrabbit/1.0-beta-6/wagon-webdav-jackrabbit-1.0-beta-6.pom'.
         > Connection to http://repo1.maven.org refused
      > Could not resolve com.github.ben-manes:gradle-versions-plugin:0.4.
     Required by:
         :sulky-master:unspecified
      > Could not GET 'http://repo1.maven.org/maven2/com/github/ben-manes/gradle-versions-plugin/0.4/gradle-versions-plugin-0.4.pom'.
         > Connection to http://repo1.maven.org refused

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 44.897 secs   

I found I can access the destination file from my web browser. So I'm confused about the error message about the connection failure.

Or does that mean the gradle program does not have the right to access internet? If so, please give some workaround for it.

Thanks,
Terry.

Best Answer

Open gradle.properties and add the following

systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=3213
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=3213

(Your settings might be different. My case was I was sharing a VPN connection by Astrill from another computer. See http://gradle.org/docs/current/userguide/build_environment.html for more information.)