【问题标题】:Grails wants to downgrade my plugins when I copy my app to a new machine当我将应用程序复制到新机器时,Grails 想要降级我的插件
【发布时间】:2012-07-11 01:45:37
【问题描述】:

当我将我的应用程序复制到另一台机器并执行“grails run-app”时,grails 似乎跳过了更新其本地插件的步骤。 (我的意思是第一台电脑刚刚做了Downloading: plugins-list.xml,但是当我在第二台机器上运行应用程序时,新机器不会做这一步。)我收到这条消息:

Loading Grails 2.0.3
Configuring classpath

Environment set to development.....
Packaging Grails application
You currently already have a version of the plugin installed [resources-1.1.6]. Do you want to update to [resources-1.1.5]? [y,n] n
Plugin resources-1.1.5 install aborted
Compiling 92 source files

我的诊断正确吗?如何强制更新?此外,如果我接受降级,我的应用程序就会中断。不知道这是怎么回事,因为它使用 1.1.5 有一段时间了..

我感觉正在发生的事情是 grails 会在 grails 的插件魔法上次更新时在项目中做一个记录,所以当我移动项目时,其他 grails 错误地认为它刚刚更新。这完全正确吗?

【问题讨论】:

    标签: grails plugins dependencies


    【解决方案1】:

    您是在BuildConfig.groovy 文件中指定插件,还是使用install-plugin 命令“安装”插件?我的阅读表明不再推荐使用install-plugin 命令,您应该在BuildConfig.groovy 文件中指定插件,然后Grails 将处理它,而不管您部署在什么机器上。

    例子:

    plugins {
        /*
        * build - dependency that is only needed by the build process
        * compile - dependency that is needed at both compile-time and runtime. This is the most common case
        * provided - dependency that is needed at compile-time but should not be packaged with the app (usually because it is provided by the container). An example is the Servlet API
        * runtime - dependency that is needed to run the application, but not compile it e.g. JDBC implementation for specific database vendor. This would not typically be needed at compile-time because code depends only the JDBC API, rather than a specific implementation thereof
        * test - dependency that is only needed by the tests
        */
        runtime ":cached-resources:1.0"
        runtime ":database-migration:1.1"
        runtime ":hibernate:$grailsVersion"
        runtime ":jquery:1.7.1"
        runtime ":resources:1.1.6"        
        runtime ":yui-minify-resources:0.1.4"
        runtime ":zipped-resources:1.0"
    
        compile ":cache-headers:1.1.5"
        compile ":commentable:0.8.1"
        compile ":jquery-ui:1.8.15"
        compile ":joda-time:1.4"
        compile ":searchable:0.6.3"
        compile ":spring-security-ldap:1.0.6" // Also installs spring-security-core
    
        build ":tomcat:$grailsVersion"
    
    }
    

    还要注意,某些插件还需要在您的 BuildConfig.groovy 文件的 dependencies 部分中添加一个特殊条目。 JodaTime 插件就是这样一个插件。

    dependencies {
        compile "org.jadira.usertype:usertype.jodatime:1.9"
    }
    

    插件的文档应指定是否需要 dependencies 部分中的任何条目。

    【讨论】:

      猜你喜欢
      • 2011-10-22
      • 1970-01-01
      • 2015-09-09
      • 2018-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-27
      • 1970-01-01
      相关资源
      最近更新 更多