Search code examples
grailsintellij-ideaspring-security

intellij can't resolve grails.plugin


I am using Grails 2.3.3 and IntelliJ ultimate 12.1.6 on my Vista 32 machine.

I used grails command line to create a new app and then added spring security and spring security ui. My BuildConfig.groovy plugins section contains

compile ":spring-security-core:2.0-RC2"
compile ":spring-security-ui:1.0-RC1"

I ran

grails s2-quickstart
grails s2ui-override auth
grails s2ui-override register 

My generated RegisterController looks like this:

class RegisterController extends grails.plugin.springsecurity.ui.RegisterController {
}

the grails.plugin is red and unresolved and no matter what I try I can't get IntelliJ to resolve grails.plugin

Grails compiles and runs the app without issue, and if I override methods I find in the source code for the spring ui RegisterController they are correctly wired in to the app, but I can't even compile from intell and I can't get intellij to help me override code.

I thought maybe creating the project outside of IntelliJ was an issue so I created a new Grails project using the IntelliJ interface, the plugins still do not resolve.

I tried adding the plugins as runtime with no success.

I have spent the afternoon and evening researching this with no success. There are questions similar to this with major versions 10 and 11 of IntelliJ but nothing current, so I am resolved to asking for help to get IntelliJ to recognize the Grails plugin classes. I can post an entire small sample project if necessary.

Thanks. Dave


Solution

  • I often have this issue when I place a new plugin into my BuildConfig.groovy, but not typically when I add a jar dependency.

    I resolve it by doing the following in the menu: Tools > Grails > Synchronize Grails Settings

    You can tell whether or not a plugin is synchronized in IDEA by navigating in the Project view to grails-app > target > work > plugins. Each synchronized plugin with have a tiny blue square over the bottom right corner of the directory icon. If it doesn't have that icon, it isn't synchronized with IDEA properly.