如何安装Joda-time

时间:2014-05-19 07:58:27

标签: grails

我试图在我当前的grails应用程序中安装joda-time使用以下命令:

plugins {
    compile "org.jadira.usertype:usertype.jodatime:1.9"

}

当我尝试编译

时,它给出了愚蠢的错误
Loading Grails 2.3.0
| Configuring classpath
| Error Resolve error obtaining dependencies: Could not find artifact org.jadira.usertype:usertype.jodatime:zip:1.9 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
| Error Resolve error obtaining dependencies: Could not find artifact org.jadira.usertype:usertype.jodatime:zip:1.9 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
| Error Resolve error obtaining dependencies: Could not find artifact org.jadira.usertype:usertype.jodatime:zip:1.9 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
| Error Could not find artifact org.jadira.usertype:usertype.jodatime:zip:1.9 in grailsCentral (http://repo.grails.org/grails/plugins)
| Run 'grails dependency-report' for further information.

任何解决方案的人?

3 个答案:

答案 0 :(得分:2)

请注意,在BuildConfig.groovy中,您有两个块可以包含您的依赖项:

在依赖项块中,您可以从hereofficial docomentation

获取依赖项
dependencies {
    <'where you put dependencies in this format'>
    compile 'joda-time:joda-time:2.6' 
    //or like official documentation
    //compile "org.jadira.usertype:usertype.jodatime:1.9"
}

在插件中,您可以从here

获取依赖项
plugins {
    <'where you put dependencies in grails format'>
    compile ':joda-time:1.5'

}

答案 1 :(得分:1)

我使用了以下内容并且有效:

plugins {
    compile ":joda-time:1.4"
}

答案 2 :(得分:1)

你应该在mavenCentral()中添加一些额外的存储库并放入编译“org.jadira.usertype:usertype.jodatime:1.9”

  mavenCentral()
    mavenRepo "http://repo.grails.org/grails/libs-releases/"
    mavenRepo "http://m2repo.spockframework.org/ext/"
    mavenRepo "http://m2repo.spockframework.org/snapshots/"
}

dependencies {

    // runtime 'mysql:mysql-connector-java:5.1.22'
    compile "org.jadira.usertype:usertype.jodatime:1.9"
}
希望有所帮助!