EAP does not recognize Groovy SDK in the module dependencies

After opening my project with IDEA 14 EAP, I can't compile because of the following error:

Error:Cannot compile Groovy files: no Groovy library is defined for module 'testing'



I can see the groovy-2.2.2, groovy-ant-2.2.2 and groovy-xml-2.2.2 library as compile dependencises in the modules view.
The same project is working fine in IDEA 13.

On a different single-module project I can compile Groovy just fine. In noticed that on the qworking build, the groovy dependency had a Groovy SDK icon, while on the failing  build it had a regular JAR icon.

Also the working project was Gradle imported using the IDEA's gradle plugin and was using Groovy 2.3.0, while the failing project was generated using Gradle's "idea" task (long story) and was using Groovy 2.2.2.

Has anybody else seen this behavior?

2 comments
Comment actions Permalink

I've seen it happen in IDEA 13 when I try to use JDK 1.8 for a groovy project (generated from Gradle's IDEA plugin).
When I change my JDK to 1.8, I get this error; change it back to 1.6, no problem.

0
Comment actions Permalink

Not the case here - using JDK 1.6.0_u37. From trial and error, for now I am coming to the conclusion that IDEA recognizes the Groovy runtime only when the groovy.jar is attached as a library, and not as a JAR directly in the IML.

This means we are forced to use IDEA's Gradle integrationa and can not use Gradle's IDEA plugin. This is not a good solution for us, as we have some extra customizations for the generated project that we miss otherwise. Furthermore, for one of our ivy repositories IDEA picks differnt (wrong) artifacts than Gradle.

I have modified the project files generated by Gradle and added a Groovy SDK as a library manually - that works, but is a hack.

Meanwhile here is a Gradle project you can use to reproduce the issue:

file('src/main/groovy').mkdirs()
file('src/main/groovy/Test.groovy').text = 'class Foo {}'

apply plugin: 'groovy'
apply plugin: 'idea'

dependencies { compile "org.codehaus.groovy:groovy:2.3.3" }

Save the file in empty dir and run 'gradle idea' and open the project -> it won't compile.

Import using IDEA's integration -> compiles.

Created http://youtrack.jetbrains.com/issue/IDEA-126700

0

Please sign in to leave a comment.