IntelliJ IDEA and Gradle - Cannot be applied to '(groovy.lang.Closure)' IntelliJ IDEA and Gradle - Cannot be applied to '(groovy.lang.Closure)' java java

IntelliJ IDEA and Gradle - Cannot be applied to '(groovy.lang.Closure)'


I've noticed this often. When creating a new project and using the 'Gradle' template, IntelliJ seems to get it all wrong. So what I've resorted to doing is after creating a new project, delete the .idea and .iml files and re-open the project directly from the Gradle file. IntelliJ seems to better understand what is going on in this case.


For the first part of the question: group is a property, so there must be an assignment, not a function call. The right code is:

group = 'com.me.blah'


I found this suggestion in the IDEA bug tracker(IDEA-142683):

Workaround:
One can add a comment such as
//noinspection GroovyAssignabilityCheck
to suppress the warning, but this should not be necessary as these are standard every day Gradle usages.

This issue was recently updated and is marked fixed, ready for release with version 2016.2 release.