如何从artifactory中获取自定义Grails插件的最新更改而不从.grails文件夹中删除插件?

时间:2014-11-20 16:29:29

标签: grails-plugin artifactory grails-2.3

问题

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

我认为执行 grails compile grails 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

}

1 个答案:

答案 0 :(得分:1)

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

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

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

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

请查看http://grails.org/doc/latest/guide/conf.html#changingDependencies了解详情。

谢谢,
SA