适用于Grails插件的Artifactory repo结构?

时间:2014-07-02 01:32:51

标签: grails repository grails-plugin artifactory

我有一个Grails(2.3.6)插件(grails-myplugin)需要我的Grails应用程序(myapp)使用。在MyPluginPlugin.groovy内,我有:

def version = "0.1.0"

在插件上运行package-plugin后,我离开了grails-myplugin-0.1-0.zip

我有一个Artifactory服务器位于:

http://myartifactory01/artifactory

在此Artifactory实例中,有一个名为myorg-releases的仓库。

myapp BuildConfig.groovy内部我需要将插件指定为插件:

plugins {
    compile:    "???"
}

我的问题:

  1. 我的compile闭包(在BuildConfig.groovy内)需要从Artifactory中拔出插件是什么意思?
  2. Artifactory中的插件需要什么样的存储库路径?像http://myartifactory01/artifactory/simple/myorg-releases/???这样的东西?让我们假设在正常的Maven / Ivy情况下,organizationmyorgmodule的名称为grails-myplguinmyplugin (无论惯例状态如何),当前revision0.1.0
  3. 如何处理插件的版本控制?标准做法是仅增加version(在MyPluginPlugin.groovy内),然后运行package-plugin并将新版本发布到Artifactory?或者有更好/更优选的方式吗?

1 个答案:

答案 0 :(得分:2)

以下是我使用标准Artifactory安装的方式。

编辑:对于问题3,您可以提高插件描述符中的版本号,或者如果进行细微更改,您可以使用相同的版本号(--allow-overwrite)重新发布它,并删除myApp'目标目录,它将强制安装新的插件。

/path/to/myPlugin/grails-app/conf/BuildConfig.groovy:

grails.project.dependency.distribution = {
    remoteRepository(id: "localPluginReleases", url: "http://localhost:8081/artifactory/plugins-release-local/")
    remoteRepository(id: "localPluginSnapshots", url: "http://localhost:8081/artifactory/plugins-snapshot-local/")
}

外壳:

cd /path/to/myPlugin
grails clean
grails compile
grails publish-plugin --allow-overwrite --noScm --repository=localPluginReleases

/path/to/myApp/grails-app/conf/BuildConfig.groovy:

repositories {
    mavenRepo "http://localhost:8081/artifactory/plugins-snapshot-local/"
    mavenRepo "http://localhost:8081/artifactory/plugins-release-local/"
}

plugins {
    compile ":myplugin:0.1"
}