【问题标题】:How to get the latest changes in custom Grails plugin from artifactory without deleting the plugin from .grails folder?如何在不从 .grails 文件夹中删除插件的情况下从工件中获取自定义 Grails 插件的最新更改?
【发布时间】:2015-01-18 14:43:14
【问题描述】:

问题

我有一个自定义插件已成功发布到 Artifactory 中,并且我已通过在下面的 BuildConfig.groovy 中使用以下语法将其成功加载到我的应用程序中。但是,当我对插件进行更改并发布它们时,我想将这些最新更改添加到使用该插件的应用程序中吗?

我认为执行 grails compilegrails refresh-dependencies 会获取最后的代码,但是当我转到 grails-app.domain 文件夹时,我没有看到我的新域类。

当前的解决方法

我必须去我的 .grails/2.3.4/projects/myProject/plugins 删除插件,然后运行 ​​grails refresh-dependencies 以获得最新版本的插件。

问题

  • 有没有更快/更好的方法来做到这一点,而不必困扰 .grails 目录中的插件?

附上我的 BuildConfig.groovy 的相关部分,以备不时之需:

repositories {
    inherits true // Whether to inherit repository definitions from plugins

    //This is to be able to download our own custom plugins
    String serverRoot = 'http://serverRoot/artifactory'
    mavenRepo serverRoot + '/plugins-snapshot-local/'
    mavenRepo serverRoot + '/plugins-release-local/'

    grailsPlugins()
    grailsHome()
    mavenLocal()
    grailsCentral()
    mavenCentral()
    mavenRepo 'http://repo.spring.io/milestone'
}


plugins {

    // plugins for the build system only
    build ":tomcat:7.0.47"

    // plugins for the compile step
    compile ":scaffolding:2.0.1"
    compile ':cache:1.1.1'

    // plugins needed at runtime but not for compilation
    runtime ":hibernate:3.6.10.6" // or ":hibernate4:4.1.11.6"
    runtime ":database-migration:1.3.8"
    runtime ":jquery:1.10.2.2"
    runtime ":resources:1.2.1"
    compile ':spring-security-core:2.0-RC2'
    compile ":spring-security-ldap:2.0-RC2"
    compile ":spring-security-ui:1.0-RC1"
    compile ":mycustomplugin:0.1"    //This is the plugin that I want get the latest code for

}

【问题讨论】:

    标签: grails-plugin artifactory grails-2.3


    【解决方案1】:

    管理插件的最佳做法是在修改插件代码时更改插件版本。

    例如,您当前的版本是 0.1,当您在域或其他地方更改某些内容时,请将插件描述符文件中的版本更改为 0.2 或其他内容,然后发布插件。现在在 BuildConfig.groovy 中使用新版本 0.2 作为 compile ":mycustomplugin:0.1"

    但有时需要对已经发布的版本进行一些更改,那么有两种方法可以做到。首先是在您的插件版本中添加 -SNAPSHOT,然后 Grails 将始终拉取该插件的最新版本,其次是向其添加 changeing 标志。

    compile(":mycustomplugin:0.1") {
        changing = true
    }
    

    请查看http://grails.org/doc/latest/guide/conf.html#changingDependencies 了解更多信息。

    谢谢,

    【讨论】:

      猜你喜欢
      • 2013-11-14
      • 2018-02-14
      • 1970-01-01
      • 2012-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多