1

I am trying to set up a Java project in Eclipse which uses Gradle for its builds plus some self-defined Groovy code for the builds (placed - as usual - under buildSrc). So I first created a Java project from the existing code and then additionally assigned the "Gradle nature" to the project. Since then I keep getting this error message:

Could not run phased build action using Gradle installation 'C:\opt\gradle-5.4.1'. 
Execution failed for task ':buildSrc:compileGroovy'. 
Compilation failed; see the compiler error output for details.

What is this message trying to tell me???

mmo
  • 3,897
  • 11
  • 42
  • 63

1 Answers1

-1

This issue was raised several times in the past. To solve it:

  1. Delete all the files in the .gradle directory in your project and under your username, e.g.:

    C:\Users\username\.gradle
    
  2. Restart your computer.
  3. Run Eclipse as administrator.
  4. Build the project.
  5. Finally, if you have any script which runs Gradle in addition to the installation /distribution of Gradle that Eclipse knows - do NOT use the script. It seems to confuse Eclipse regarding the location of Gradle.
Itamar cohen
  • 59
  • 1
  • 5
  • Why the need to delete `~/.gradle`? Also, why the need to restart the machine! This answer isn't useful at all. – joker Jan 12 '21 at 11:29
  • joker, at least for me, it indeed worked only after I deleted .gradle. However, there were some files for which exiting Eclipse wasn't enough - they had some lock, and I could delete them only by rebooting. – Itamar cohen Jan 14 '21 at 15:10
  • BTW, the suggestion to delete .gradle appears also in similar threads, e.g. https://stackoverflow.com/questions/32887623/errorcould-not-run-build-action-using-gradle-installation-gradle-2-4-android and https://stackoverflow.com/questions/27951027/errorcould-not-run-build-action-using-gradle-installation-c-program-files-and – Itamar cohen Jan 14 '21 at 15:11