Could not open buildscript class cache for build file


(Mark Petrovic) #1

For Gradle v1.3, I have a subproject for which I moved src/test to src/intTest, and added to the subproject build file what I consider the canonical additional sourceset for integration-test-type code:

sourceSets {
    intTest {
        compileClasspath = sourceSets.main.output + configurations.testRuntime
        runtimeClasspath = output + sourceSets.main.output + configurations.testRuntime
    }
}
  task intTest(type: Test) {
    testClassesDir = sourceSets.intTest.output.classesDir
    classpath = sourceSets.intTest.runtimeClasspath
}

I ran the standard build thusly

$ gradle --info clean build

and got this

...
FAILURE: Build failed with an exception.
  * What went wrong:
Could not open buildscript class cache for build file '/Users/petrovic/Projects/x/qa/prod/geb-browser/build.gradle' (/Users/petrovic/.gradle/caches/1.3/scripts/build_3h4a8sacjqqdpujod9rg3b4kfv/ProjectScript/buildscript).
> java.io.EOFException
  * Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
  BUILD FAILED
  Total time: 1 mins 7.539 secs

I then simply re-ran the build and it worked as expected. That’s good, but I’m not sure why it failed the first time and why it succeeded the second time without my doing any cleanup of the gradle cache (even then, I’d just start blowing cache directories away, hoping that helped — I’m not really sure what I’d be doing, other than wholesale deletion of cache stuff).