0

I'm currently using Intellij IDEA 11.1.4 and though I've seen a few posts regarding issues with Grails plug-ins dependencies, I haven't been able to solve the problem locally. It seems as though Intellij doesn't recognize the plugins as relative to the project module.

For instance all dependencies.groovy files under plug-ins are showing errors for Unresolved Reference Access. However, the main project doesn't seem to have this issue.

Is there any specific build requirement needed for Intellij to recognize Grails-app plugins?

I've attempted running grails clean, re-building the project from scratch, and still the error persists ...

Grails-Plug-in App Dependency Error

Edward J Beckett
  • 5,061
  • 1
  • 41
  • 41
  • No, there is no specific build requirement for IntelliJ to recognize Grails plugins. IntelliJ does sometimes get 'confused'. What seems to help then is to grails clean, synchronize IntelliJ's Grails settings and grails run. Synchronizing IntelliJ's Grails settings can be done by right clicking on your project in the project view and selecting 'Synchronize Grails settings' in the Grails sub menu. – Ruben Nov 07 '12 at 08:04
  • Thanks @Ruben ... I've been combing the grails docs and SO for hours still to no avail. I can only presume this is caused by the plugins being under $HOME/.grails/$grails-version/projects/$project/plugins ... and my the project being under my 'projects' dir. – Edward J Beckett Nov 07 '12 at 08:09
  • The plugins should be in your $HOME/.grails/... directory, and IntelliJ should not have a problem with that. My (lousy) advice is to recreate the project again in IntelliJ making sure it is created as a Grails setting, ... . I also do not have experience with the conditional dependency in IntelliJ. You might give it a try without the conditional around the dependency. – Ruben Nov 07 '12 at 08:36

2 Answers2

1

Okay ... After hours of searching I figured out this 'issue' by complete accident. The invalid references are not related to grails dependency errors per-se but a are actually references to Groovy Dynamic Properties not being set for the Grails plug-ins that Intellij IDEA needs to relate Groovy DSL Expressions. Basically my problem was a lack of understanding about Intellij's support for DSL languages.

The solution was to simply add the dynamic properties by selecting ALT+ENTER at the method or property and to invoke the 'Add Dynamic Property' dialogue.

enter image description here

Once added the reference errors disappeared.

Edward J Beckett
  • 5,061
  • 1
  • 41
  • 41
0

I see you resolved your specific issue, but this might help others with a similar issue to what I had.

I was getting this problem as late as IntelliJ 12! My project uses maven to fetch my plugin dependencies. I could not for the life of me get IntelliJ to recognize the classes for plugins that my pom declares.

IntelliJ finally recognized my plugin classes after running:

mvn grails:exec -Dcommand="clean"

Then I right-clicking my project root in the Grails view and selecting Grails > Syncronize Grails Settings

Worked like a charm. If you aren't using maven, you can just do a normal grails clean instead of the maven command above.

ganta
  • 366
  • 2
  • 9