Grails 4:是否为Grails 4.0更新了spring-security-ldap?

时间:2019-07-02 19:25:28

标签: grails spring-security-ldap

我正在将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

1 个答案:

答案 0 :(得分:0)

由于更改了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