无法将 apache-ldap-api 与 grails 2.2 一起使用



我正在尝试将apache-ldap-api与grails 2.2一起使用。他们网站上的API的最新版本是 1.0.0-M15 ,但maven repo的最高版本为1.0.0-M13。所以我决定首先使用 M13,向 BuildConfig.groovy 添加一个依赖项:

dependencies {
    // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
    runtime(
        [group: 'org.apache.directory.shared', name: 'apache-ldap-api', version: '1.0.0-M13']
    )
    // runtime 'mysql:mysql-connector-java:5.1.20'
}

Grails下载了依赖项,但是当我尝试在代码中使用API时,例如:

import org.apache.directory.groovyldap.LDAP
LDAP.newInstance(...)

我收到一个编译错误:

LdapController.groovy: 2: unable to resolve class org.apache.directory.groovyldap.LDAP
  @ line 2, column 1.
import org.apache.directory.groovyldap.LDAP
^
1 error

编译器允许我导入'org.apache.directory.groovyldap.*',但话又说回来,对'LDAP.newInstance()'的调用会引发异常。我还尝试手动将 1.0.0-M15 版本放在我的/lib 文件夹中并运行"grails compile --refresh-dependencies",但没有任何运气。如果我在这里做错了什么,有什么想法吗?

谢谢!

1 运行此 grails 编译 --refresh-dependencies2 将 LDAP.newInstance(...) 更改为新的 LDAP

这就是它对我的工作方式

最新更新