helloWorld problems: Socket creation failed; source dir does not exist

New user.

Windows 7. gradle -v works. but gradle -q helloWorld: A problem occurred configuring root project ‘bin’. > Could not open buildscript class cache for build file > java.net.SocketException: Unrecognized Windows Sockets error: 87: Socket creation failed

Any clues about this message?

A debug msg said: Gradle source dir does not exist. How is the source dir set?

I think it would be useful to see more information, like your build script and your directory structure.

Sounds like Gradle can’t do networking on that box, or perhaps it can’t write to the project directory or user home directory (’~/.gradle’). Perhaps some Windows share is involved? ‘–stacktrace’ might give some more insight. The message about the source dir is probably unrelated.

@David The build.gradle file has

task helloWorld << {
  println 'hello, world'
}

That file is in …\gradle-2.0\bin

@Peter I don’t see anything about networking in the manual. I’ve downloaded many software packages; never had a problem writing to my directories; I’m the only user on my computer.

I changed the Path variables as instructed.

gradle -v shows correct information. gradle -q helloWorld does not work.

Apparently there are other steps that I missed.

The “source dir does not exist” msg is the first negative.

C:\Programs Unzipped\Gradle\gradle-2.0\bin>gradle helloWorld --debug [INFO] [org.gradle.BuildLogger] Starting Build [DEBUG] [org.gradle.BuildLogger] Gradle user home: C:\Users\George.gradle [DEBUG] [org.gradle.BuildLogger] Current dir: C:\Programs Unzipped\Gradle\gradle-2.0\bin [DEBUG] [org.gradle.BuildLogger] Settings file: null [DEBUG] [org.gradle.BuildLogger] Build file: null [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Starting to build the build sources. [DEBUG] [org.gradle.initialization.buildsrc.BuildSourceBuilder] Gradle source dir does not exist. We leave. “We leave???” Does that mean abort? Why does it continue?

Debug logs aren’t targeted at users, and will likely get you down the wrong path.

There are no other steps. ‘build.gradle’ should not be put inside the Gradle installation dir. Output of ‘gradle -v’ and ‘gradle helloWorld --stacktrace’ might help.

As stated, I have Windows 7; gradle-2.0-all.zip was unzipped to:

C:\Programs Unzipped\Gradle\gradle-2.0\

I’m using this guide: http://gradleware.com/registered/books/building-and-testing/index.html In chapter 1, “Hello Gradle”, I followed 1.3.3. Windows Installation.

To verify correct Path, I start Command Prompt. C:\Users\George> is initial directory path.

I enter gradle -v

C:\Users\George>gradle -v

------------------------------------------------------------ Gradle 2.0 ------------------------------------------------------------

Build time:

2014-07-01 07:45:34 UTC Build number: none Revision:

b6ead6fa452dfdadec484059191eb641d817226c

Groovy:

2.3.3 Ant:

Apache Ant™ version 1.9.3 compiled on December 23 2013 JVM:

1.7.0_51 (Oracle Corporation 24.51-b03) OS:

Windows 7 6.1 amd64

.1 The Path is apparently OK; it found gradle.bat. .2 Does the information look OK?

The very next step is: 1.4 The Hello World Build File Now that we have Gradle installed, we can start using it. Let’s build the simplest build file that we possibly can to get an idea of the basics.

Create a file called build.gradle that looks like Example 1.1. task helloWorld << {

println ‘hello, world’ }

I have no idea where this file should be located; there is no suggestion.

My initial attempt was to include it in the installation bin folder. You say it cannot be located there.

So I made a new folder C:DATA\Gradle\ and placed the build.gradle file there. Change directory so the file will be found, try again: C:\DATA\Gradle> gradle -q helloWorld FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project ‘Gradle’. > Could not open buildscript class cache for build file ‘C:\DATA\Gradle\build.gradle’ (C:\Users\George.gradle\caches\2.0\ scripts\build_5jvridq7k28qgmlao7pte82rfs\ProjectScript\buildscript).

java.net.SocketException: Unrecognized Windows Sockets error: 87: Socket creation failed

Does this shed any light, before I send stacktrace info (which is totally Greek to me)?

I don’t think this is a Gradle problem. I saw a bunch of other people on the net with the same error message. Strangely, most of them are getting it with Minecraft. Windows is hosed.

@Peter, here is the stack trace. I hope it works - first time to try this. https://gist.github.com/gstech99/11b144db0b21a8159b63

Update. On another Windows7 machine: Downloaded Gradle v1.0; helloWorld works. Downloaded Gradle v2.0; helloWorld works.

Back to my development machine. Downloaded Gradle v1.0; helloWorld works. Delete original Gradle v2.0 unzipped folder. Downloaded Gradle v2.0; helloWorld does not work.

The size of new v2.0 unzipped folder is same as deleted folder.

How could this machine run v1.0 OK, but have problems with v2.0?

Has anyone looked at the stacktrace I provided yesterday? Not acquainted with stacktrace, when helloWorld ran OK on the other machine,

I tried gradle helloWorld --stacktrace to get “good” information, for comparison. But no stacktrace was produced. Is that because there was no problem?

Update. Further investigation shows something is different starting in v 1.7 that affects Windows 7 adversely.

The build.gradle “helloWorld” file works with Gradle versions 1.0 to 1.6. It does not work in versions 1.7 - 1.12 and 2.0.

Note, the format of information (gradle -v) changed in v 1.7. ------------------------------------------------------------ Gradle 1.6 ------------------------------------------------------------

Gradle build time: Tuesday, May 7, 2013 9:12:14 AM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy: 2.2.0
JVM: 1.7.0_51 (Oracle Corporation 24.51-b03)
OS: Windows 7 6.1 amd64

------------------------------------------------------------ Gradle 1.7 ------------------------------------------------------------

Build time:
 2013-08-06 11:19:56 UTC
Build number: none
Revision:
   9a7199efaf72c620b33f9767874f0ebced135d83
  Groovy:
     1.8.6
Ant:
        Apache Ant(TM) version 1.8.4 compiled on May 22 2012
Ivy:
        2.2.0
JVM:
        1.7.0_51 (Oracle Corporation 24.51-b03)
OS:
         Windows 7 6.1 amd64

Could something else have changed starting in v 1.7 that causes a problem in Windows 7?

Final update - solution has been found on Windows 7.

.1 Run Command Prompt as Administrator. .2 enter: netsh winsock reset .3 Restart pc

I found this at:

Mysteries: What exactly this reset does. Why Gradle versions prior to 1.7 were not affected.