4

I'm trying to run gradlew to build some code that had been supplied to me. The source is the ZIP download from here and all I've done is open a command prompt, cd to that folder and run gradlew.bat.

I've had this work on my crash'n'burn machine but I can't get it working on my main dev machine. The dev machine sits behind a proxy which requires authentication, the other machine doesn't - they're at different locations.

Originally, I got:

Exception in thread "main" java.net.UnknownHostException: services.gradle.org

From this, to gradle.properties, I added:

systemProp.http.proxyHost=192.168.x.y 
systemProp.http.proxyPort=80
systemProp.http.proxyUser=myuserid
systemProp.http.proxyPassword=mypassword

and ran it again and got:

C:\Users\tso259sa\workspace\spring-security-saml-master>gradlew.bat
Downloading http://services.gradle.org/distributions/gradle-1.4-bin.zip

Exception in thread "main" java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:189)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
    at sun.net.www.MeteredStream.read(MeteredStream.java:134)
    at java.io.FilterInputStream.read(FilterInputStream.java:133)
    at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3052)
    at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3046)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:67)
    at org.gradle.wrapper.Download.download(Download.java:49)
    at org.gradle.wrapper.Install.createDist(Install.java:51)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

For info, if I try an incorrect password or ID, I get:

Exception in thread "main" java.net.ProtocolException: Server redirected too many  times (20)

so I think that rules out incorrect ID. Anyone have any ideas what I can try?

Community
  • 1
  • 1
ssg31415926
  • 1,037
  • 2
  • 13
  • 21
  • I found this answer useful, I also had the same problem. [Answer to -> UnknownHostException error, building java grpc example](https://stackoverflow.com/a/57324396/11618893) – Deepak Kumrawat Aug 02 '19 at 10:16

3 Answers3

2

I don't know exactly what caused the connection reset but I tried again several times, in case it was transient and, after some time, the response changed to:

Exception in thread "main" java.io.IOException: Server returned 
HTTP response code: 403

Suspecting our security systems, I tried to download the file using a browser and received a message from one of the security boxes saying it had been blocked because it contained a .bat file: a regular occurrence.

ssg31415926
  • 1,037
  • 2
  • 13
  • 21
2

Look in your build.gradle and gradle.properties and edit 'https://' to 'http://' in all links

Subhrajyoti Sen
  • 1,525
  • 14
  • 18
1

I still got this issue today. Different company has different proxy settings. after investigate, it worked for me:

org.gradle.daemon=true
systemProp.https.proxyHost=[server name]
systemProp.https.proxyPort=[port]
systemProp.https.proxyUser=[user name]
systemProp.https.proxyPassword=XXXXX
systemProp.https.nonProxyHosts= localhost
systemProp.http.proxyHost=[server name]
systemProp.http.proxyPort=[port]
systemProp.http.proxyUser=[user name]
systemProp.http.proxyPassword=XXXXX
systemProp.http.nonProxyHosts= localhost
javapedia.net
  • 2,531
  • 4
  • 25
  • 50
Phily Woo
  • 11
  • 1