【问题标题】:Can't import grails.plugin.springsecurity.annotation in Grails 3?无法在 Grails 3 中导入 grails.plugin.springsecurity.annotation?
【发布时间】:2017-01-26 12:19:08
【问题描述】:

我一直在关注 Burt Beckwith 关于 Grails 3 的 Spring Security 的教程。我按照教程中的说明安装了插件 build.gradle,然后运行了 s2-quickstart,这似乎工作正常。项目编译成功。

但是当我尝试导入语句时

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"

【问题讨论】:

  • 尝试清理和编译您的项目。
  • 还有助于强制 Gradle 更新 IDE 中的依赖项或通过 gradle --refresh-dependencies
  • 除非我遗漏了一些东西,否则它看起来像是从 grails 3 中删除了刷新依赖项,但看起来与 clea 然后编译的结果相同

标签: grails spring-security grails-3.0


【解决方案1】:

我可以通过单击 View \ Tools \ Gradle 窗口中的“刷新”图标在 IntelliJ 中解决此问题。

【讨论】:

    猜你喜欢
    • 2015-12-10
    • 1970-01-01
    • 2013-04-07
    • 2017-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-01
    相关资源
    最近更新 更多