2016-09-18 73 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這個問題。