Error:Cannot compile Groovy files: no Groovy libra

2019-02-06 19:44发布

问题:

I have cloned the project from github and then imported it to inetllij 2017.1. and also added all dependency modules. Basically, we are trying to upgrade our project using latest jars.

When I try to build I get the above error along with 933 errors, jdk 1.7,grails 2.5 and tomcat 8 is used. Run configuration is also throwing error as Run Configuration: cannot execute Note : previous version of my project works perfectly fine with all same settings Please help.

回答1:

Right click on the problematic module and add Groovy support to it:



回答2:

In my case it was a Spec placed in the src/main/java instead of the src/test/groovy. Unfortunately InteliJ doesn't present the error in that class but instead doesn't compile the whole module.

To find out which class is wrong just open the not compiled module settings ( F4 on it in Project tree) -> Dependencies (Tab) -> Groovy -> change from Test to Compile.

What makes the problem even worse is that maven compiled everything without problems.