无法安装Grails MongoDB插件

Gls*_*nna 4 grails plugins install mongodb

我使用的是GRails 2.4.3

每当我尝试安装Grails MongoDB插件 http://grails.org/plugin/mongodb时, 我都会收到此错误:

|Configuring classpath
|Downloading: org/grails/grails-datastore-gorm-plugin-support/3.1.0.RELEASE/grails-datastore-gorm-plugin-support-3.1.0.RELEASE.pom
|Downloading: org/grails/grails-spring/2.3.8/grails-spring-2.3.8.pom
|Downloading: org/grails/grails-datastore-web/3.1.0.RELEASE/grails-datastore-web-3.1.0.RELEASE.pom
Error |
Resolve error obtaining dependencies: Failed to read artifact descriptor for org.grails:grails-datastore-gorm-plugin-support:jar:3.1.3.BUILD-SNAPSHOT (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Failed to read artifact descriptor for org.grails:grails-datastore-gorm-plugin-support:jar:3.1.3.BUILD-SNAPSHOT (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Failed to read artifact descriptor for org.grails:grails-datastore-gorm-plugin-support:jar:3.1.3.BUILD-SNAPSHOT (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Failed to read artifact descriptor for org.grails:grails-datastore-gorm-plugin-support:jar:3.1.3.BUILD-SNAPSHOT (Use --stacktrace to see the full trace)
Error |
Failed to read artifact descriptor for org.grails:grails-datastore-gorm-plugin-support:jar:3.1.3.BUILD-SNAPSHOT
|Run 'grails dependency-report' for further information.

IDEA hook: Grails not found!
Error |
java.lang.NullPointerException
Error |
    at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:135)
Error |
    at java.lang.Thread.run(Thread.java:744)
Run Code Online (Sandbox Code Playgroud)

这些是我的buildconfig设置:

dependencies{
  ...
  compile 'org.grails:grails-datastore-gorm-plugin-support:3.1.0.RELEASE'
}
plugins{
..
compile ':mongodb:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)

即使我补充说

compile 'org.grails:grails-datastore-gorm:latest.release'
compile 'org.grails:grails-datastore-core:latest.release'
test 'org.grails:grails-datastore-simple:latest.release'
Run Code Online (Sandbox Code Playgroud)

对于插件页面中提到的依赖项(因为我在Grails 2.4上,我不应该这样做),我得到了同样的错误.

另外,这个插件几个月来一直没有为我工作过,但我还没有在网上看过这个问题.我是唯一一个经历过这种情况的人吗?

我该如何安装这个插件?谢谢.

Shi*_*hin 8

我不确切知道3.0.2为什么有这些依赖项,如果3.0.2可以使用但是如果你想让它工作,那么你需要排除SNAPSHOT依赖项并使用RELEASE版本.

plugins {
    compile (":mongodb:3.0.2") {
        excludes 'grails-datastore-gorm-plugin-support'
        excludes 'grails-datastore-gorm'
        excludes 'grails-datastore-core'
    }
}
Run Code Online (Sandbox Code Playgroud)

然后在依赖项中,拉出正确的:

dependencies {
    compile 'org.grails:grails-datastore-gorm-plugin-support:3.1.3.RELEASE'
    compile 'org.grails:grails-datastore-gorm:3.1.3.RELEASE'
    compile 'org.grails:grails-datastore-core:3.1.3.RELEASE'
}
Run Code Online (Sandbox Code Playgroud)

编辑:实际上在仔细检查3.0.2 pom时,依赖性应该是3.1.2.RELEASE所以3.1.3正在被使用的事实意味着正在发生的事情.我清理了〜/ .m2目录,'grails dependency-report'现在显示正确的3.1.2.RELEASE依赖项.