[GRADLE-1202] Could not load compiled classes for build file 'build.gradle' from cache Created: 02/Nov/10  Updated: 04/Jan/13  Resolved: 09/Aug/11

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: 1.0-milestone-5

Type: Bug
Reporter: Charles Anderson Assignee: Adam Murdoch
Resolution: Fixed Votes: 3


 Description   

I interrupted a build with control-C. The next time I ran gradle, I got:
org.gradle.api.GradleException: Could not load compiled classes for build file '/path/to/project/build.gradle' from cache.

I tried the --no-opt flag without success. What did fix it was to remove ~/.gradle, which was kinda drastic. I saved the old ~/.gradle directory if someone needs me to do any forensics on it.

Here's the stacktrace:

  • Exception is:
    org.gradle.api.GradleException: Could not load compiled classes for build file '/home/canderson/Backend/build.gradle' from cache.
    at org.gradle.groovy.scripts.DefaultScriptCompilationHandler.loadFromDir(DefaultScriptCompilationHandler.java:144)
    at org.gradle.groovy.scripts.CachingScriptCompilationHandler.loadFromDir(CachingScriptCompilationHandler.java:41)
    at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.loadViaCache(DefaultScriptCompilerFactory.java:93)
    at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:69)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:121)
    at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)
    at org.gradle.configuration.DefaultProjectEvaluator.evaluate(DefaultProjectEvaluator.java:38)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:491)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:69)
    at org.gradle.api.internal.project.ProjectInternal$evaluate.call(Unknown Source)
    at org.gradle.configuration.BuildConfigurer$_closure1.doCall(BuildConfigurer.groovy:41)
    at $Proxy6.execute(Unknown Source)
    at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:467)
    at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:462)
    at org.gradle.api.Project$allprojects.call(Unknown Source)
    at org.gradle.configuration.BuildConfigurer.process(BuildConfigurer.groovy:48)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:136)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:107)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:75)
    at org.gradle.launcher.Main.execute(Main.java:93)
    at org.gradle.launcher.Main.main(Main.java:42)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:49)
    Caused by: java.lang.ClassNotFoundException: build_gradle_4c47cbfa1b3d46865e24d8edf636bd13
    at org.gradle.groovy.scripts.DefaultScriptCompilationHandler.loadFromDir(DefaultScriptCompilationHandler.java:142)
    ... 21 common frames omitted


 Comments   
Comment by Paul Mazak [ 29/Nov/10 ]

FYI. I was able to workaround this without deleting the whole ~/.gradle directory, and instead just deleting everything under ~/.gradle/caches/0.9-rc-2/scripts.

Comment by Szczepan Faber [ 10/Mar/11 ]

Thanks for the hint. I just wasted few hours trying to figure it out

Generated at Wed Jun 30 11:49:35 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.