【问题标题】:Grails 4: Is spring-security-ldap updated for Grails 4.0?Grails 4:spring-security-ldap 是否针对 Grails 4.0 进行了更新?
【发布时间】:2019-11-13 11:33:03
【问题描述】:

我正在将我的 Grails 3.3.2 应用程序升级到 Grails 4.0.0.RC2,并且对 org.springframework.security.ldap 类的所有引用都未解决。我不确定这是等待插件的更高版本,还是我应该为 Grails 4 做一些不同的事情。如果我需要等待更高版本,是否有 ETA?

我在我的 build.gradle 文件中使用这个版本:

compile "org.grails.plugins:spring-security-ldap:3.0.2"  

以下是一些未解决错误的示例:

unable to resolve class org.springframework.ldap.core.DirContextOperations
unable to resolve class org.springframework.ldap.core.DirContextAdapter

【问题讨论】:

  • 也很想知道这一点,因为大多数课程由于某种原因无法解决。

标签: grails spring-security-ldap grails-4


【解决方案1】:

由于 Gradle 更改:

Separation of compile and runtime dependencies when consuming POMs

要在 Grails 4 应用程序中使用某些 Grails 3 插件,您需要直接包含它们的传递依赖项。否则它们不会被带入类路径。

解决方法是将依赖项直接包含在您的构建中。

ext {
    springSecurityVersion="5.1.6.RELEASE"
    springSecurityCoreVersion="4.0.0.RC2"
    springSecurityLdapVersion="3.0.2"

}
dependencies {
...
// Security
    compile "org.grails.plugins:spring-security-core:$springSecurityCoreVersion"
    compile ("org.grails.plugins:spring-security-ldap:$springSecurityLdapVersion") {
        exclude group: 'org.grails.plugins', module:'spring-security-core'
    }
    compile "org.springframework.security:spring-security-ldap:$springSecurityVersion", {
        ['apacheds-core', 'apacheds-core-entry', 'apacheds-protocol-ldap', 'apacheds-protocol-shared',
         'apacheds-server-jndi', 'commons-logging', 'fest-assert', 'jcl-over-slf4j', 'junit',
         'ldapsdk', 'logback-classic', 'mockito-core', 'shared-ldap', 'slf4j-api', 'spring-beans',
         'spring-context', 'spring-core', 'spring-ldap-core', 'spring-security-core',
         'spring-test', 'spring-tx'].each { exclude module: it }
    }

    compile 'org.springframework.ldap:spring-ldap-core:2.0.4.RELEASE', {
        ['commons-lang', 'gsbase', 'junit', 'mockito-core', 'powermock-api-mockito',
         'powermock-api-support', 'powermock-core', 'powermock-module-junit4',
         'powermock-module-junit4-common', 'powermock-reflect', 'slf4j-log4j12', 'spring-beans',
         'spring-core', 'spring-data-commons', 'spring-test', 'spring-tx'].each { exclude module: it }
    }

我从插件中获取了传递依赖:

https://github.com/grails-plugins/grails-spring-security-ldap/blob/master/build.gradle#L63-L76

【讨论】:

    猜你喜欢
    • 2015-05-04
    • 2011-08-15
    • 2018-10-12
    • 1970-01-01
    • 2011-09-23
    • 2017-02-22
    • 2014-04-01
    • 2018-03-02
    • 2011-08-01
    相关资源
    最近更新 更多