Idea error Cannot compile Groovy files: no Groovy library is defined for module 'XX', compilegroovy
0. Cause description
Clone the original project (the new project is generally not available)
IntelliJ IDEA associates objects suffixed with groovy but does not configure Groovy libraries.
1. Solution to cause 1
Cause: Groovy, which is not required in this project, is associated with a groovy file.
Fang Zi: remove the groovy extension.
Result: Good. This is basically the case on the Internet.
Remove the red box and apply
2. Solution to cause 2
Cause: the project requires groovy library.
Fang Zi: Configure groovy library.
Steps:
① Download groovy library
② Decompress the package (select a favorite directory, and the best directory path is full of English)
③ Configure groovy library: File-> Project Structure-> Modules-> Groovy-> Add Groovy Support-> select Groovy library and then apply.
Quick configuration entry: If IDEA has the following prompt, it is best-convenient. Click Configuration Groovy SDK.