Terry.Su
Terry.Su

Reputation: 201

A Build Issue when using 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.

Upvotes: 10

Views: 11292

Answers (3)

mycowan
mycowan

Reputation: 1013

To add to what @Bugs Bunny said:

If you have set “GRADLE_USER_HOME” environment variable pointing to C:\Documents and Settings\myAccount\.gradle you can put gradle.properties in that .gradle directory.

A copy of gradle.properties file can be found at C:\gradle-2.13\samples\userguide\tutorial\properties\gradle.properties.

But it doesn't have the proxyHost settings.

I would add the following to gradle.properties:

systemProp.http.proxyHost=proxy_address
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=my_user_name
systemProp.http.proxyPassword=my_secret_password

systemProp.https.proxyHost=proxy_address
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=my_user_name
systemProp.https.proxyPassword=my_secret_password

Upvotes: 2

Om Sao
Om Sao

Reputation: 7673

2022 update

In the latest version of gradle, you may not find gradle.properties. You can find instead ./gradle/wrapper/gradle-wrapper.properties.

Append the proxy information in this file:

systemProp.http.proxyHost=<your proxy>
systemProp.http.proxyPort=<your port>
systemProp.https.proxyHost=<your proxy>
systemProp.https.proxyPort=<your port>

Upvotes: 0

Bugs Bunny
Bugs Bunny

Reputation: 2674

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.)

Upvotes: 13

Related Questions