2016-09-18 24 views
1

我一直在关注Spring Security for Grails 3的Burt Beckwith教程。我在教程中安装了插件build.gradle,并运行了s2-quickstart,这似乎工作正常。该项目无需投诉即可编译。无法在Grails 3中导入grails.plugin.springsecurity.annotation?

然而,当我尝试导入语句

import grails.plugin.springsecurity.annotation.Secured 

进口不被识别,也不会建立,与错误

Error:(2, 1) Groovyc: unable to resolve class grails.plugin.springsecurity.annotation.Secured 

缺少了什么?

依赖的build.gradle的部分:

dependencies { 
    compile "org.springframework.boot:spring-boot-starter-logging" 
    compile "org.springframework.boot:spring-boot-autoconfigure" 
    compile "org.grails:grails-core" 
    compile "org.springframework.boot:spring-boot-starter-actuator" 
    compile "org.springframework.boot:spring-boot-starter-tomcat" 
    compile "org.grails:grails-dependencies" 
    compile "org.grails:grails-web-boot" 
    compile "org.grails.plugins:cache" 
    compile "org.grails.plugins:scaffolding" 
    compile "org.grails.plugins:hibernate4" 
    compile "org.hibernate:hibernate-ehcache" 
    compile 'org.grails.plugins:spring-security-core:3.1.1' //*** 
    console "org.grails:grails-console" 
    profile "org.grails.profiles:web" 
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.8.2" 
    runtime "com.h2database:h2" 
    testCompile "org.grails:grails-plugin-testing" 
    testCompile "org.grails.plugins:geb" 
    testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1" 
    testRuntime "net.sourceforge.htmlunit:htmlunit:2.18" 
+1

尝试清理并编译您的项目。 – quindimildev

+0

另外它有助于强制Gradle更新IDE中的依赖项或通过'gradle --refresh-dependencies'。 – Yuri

+0

谢谢你们两位。 – user1023110

回答

5

我能够通过点击查看\工具\摇篮窗口中的“刷新”图标来解决的IntelliJ这个问题。